Skip to content

Commit

Permalink
Throw more readable error message
Browse files Browse the repository at this point in the history
  • Loading branch information
garrettjstevens committed Dec 9, 2021
1 parent 459c646 commit 91773fa
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions packages/core/PluginLoader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,8 @@ export default class PluginLoader {
getGlobalObject().location.href,
)
} catch (error) {
console.error(`Error parsing URL: ${pluginDefinition.cjsUrl}`)
throw error
console.error(error)
throw new Error(`Error parsing URL: ${pluginDefinition.cjsUrl}`)
}
if (parsedUrl.protocol !== 'http:' && parsedUrl.protocol !== 'https:') {
throw new Error(
Expand Down Expand Up @@ -195,8 +195,8 @@ export default class PluginLoader {
getGlobalObject().location.href,
)
} catch (error) {
console.error(`Error parsing URL: ${pluginDefinition.esmUrl}`)
throw error
console.error(error)
throw new Error(`Error parsing URL: ${pluginDefinition.esmUrl}`)
}
if (parsedUrl.protocol !== 'http:' && parsedUrl.protocol !== 'https:') {
throw new Error(
Expand All @@ -221,8 +221,8 @@ export default class PluginLoader {
try {
parsedUrl = new URL(umdUrl, getGlobalObject().location.href)
} catch (error) {
console.error(`Error parsing URL: ${umdUrl}`)
throw error
console.error(error)
throw new Error(`Error parsing URL: ${umdUrl}`)
}
if (parsedUrl.protocol !== 'http:' && parsedUrl.protocol !== 'https:') {
throw new Error(
Expand Down

0 comments on commit 91773fa

Please sign in to comment.