@@ -3,7 +3,7 @@ import { DirectoryEntry, FileEntry, MultimodalFileInputState, type MultimodalFil
33import { SvelteSet } from "svelte/reactivity" ;
44import { type FileStatus } from "$lib/github.svelte" ;
55import { makeImageDetails , makeTextDetails , MultiFileDiffViewerState , type LoadPatchesOptions } from "$lib/diff-viewer.svelte" ;
6- import { binaryFileDummyDetails , bytesEqual , isBinaryFile , isImageFile , parseMultiFilePatch , tryCompileRegex } from "$lib/util" ;
6+ import { binaryFileDummyDetails , bytesEqual , formatErrorWithCauses , isBinaryFile , isImageFile , parseMultiFilePatch , tryCompileRegex } from "$lib/util" ;
77import { createTwoFilesPatch } from "diff" ;
88
99export interface OpenDiffDialogProps {
@@ -77,13 +77,7 @@ export class OpenDiffDialogState {
7777 } ,
7878 async ( ) => {
7979 const isImageDiff = isImageFile ( fileAMeta . name ) && isImageFile ( fileBMeta . name ) ;
80- let blobA : Blob , blobB : Blob ;
81- try {
82- [ blobA , blobB ] = await Promise . all ( [ fileA . resolve ( ) , fileB . resolve ( ) ] ) ;
83- } catch ( e ) {
84- console . log ( "Failed to resolve files:" , e ) ;
85- throw new Error ( "Failed to resolve files" , { cause : e } ) ;
86- }
80+ const [ blobA , blobB ] = await Promise . all ( [ fileA . resolve ( ) , fileB . resolve ( ) ] ) ;
8781 const [ aBinary , bBinary ] = await Promise . all ( [ isBinaryFile ( blobA ) , isBinaryFile ( blobB ) ] ) ;
8882 if ( aBinary || bBinary ) {
8983 if ( ! isImageDiff ) {
@@ -262,7 +256,7 @@ export class OpenDiffDialogState {
262256 text = await blob . text ( ) ;
263257 } catch ( e ) {
264258 console . error ( "Failed to resolve patch file:" , e ) ;
265- alert ( "Failed to resolve patch file: " + e ) ;
259+ alert ( formatErrorWithCauses ( e ) ) ;
266260 return ;
267261 }
268262 this . props . open . current = false ;
0 commit comments