Skip to content

Commit

Permalink
error handling for import
Browse files Browse the repository at this point in the history
  • Loading branch information
davidjgoss committed May 4, 2024
1 parent 29b458c commit 968fe76
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/formatter/import_code.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,11 @@ export async function importCode(specifier: string, cwd: string): Promise<any> {
} else if (specifier.startsWith('file://')) {
normalized = new URL(specifier)
}
return await import(normalized.toString())
try {
return await import(normalized.toString())
} catch (e) {
throw new Error(`Failed to import formatter ${specifier}`, {
cause: e,
})
}
}

0 comments on commit 968fe76

Please sign in to comment.