| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -18,19 +18,29 @@ export default async function load(this: LoaderContext, source: string, map: any | |||
| 18 | 18 | ||
| 19 | 19 | const context = createContext(this) | |
| 20 | 20 | const { handler } = normalizeObjectHook('load', plugin.load) | |
| 21 | - const res = await handler.call( | ||
| 22 | - Object.assign( | ||
| 23 | - {}, | ||
| 24 | - this._compilation && createBuildContext(this._compiler, this._compilation, this), | ||
| 25 | - context, | ||
| 26 | - ), | ||
| 27 | - normalizeAbsolutePath(id), | ||
| 28 | - ) | ||
| 21 | + try { | ||
| 22 | + const res = await handler.call( | ||
| 23 | + Object.assign( | ||
| 24 | + {}, | ||
| 25 | + this._compilation && createBuildContext(this._compiler, this._compilation, this), | ||
| 26 | + context, | ||
| 27 | + ), | ||
| 28 | + normalizeAbsolutePath(id), | ||
| 29 | + ) | ||
| 29 | 30 | ||
| 30 | - if (res == null) | ||
| 31 | - callback(null, source, map) | ||
| 32 | - else if (typeof res !== 'string') | ||
| 33 | - callback(null, res.code, res.map ?? map) | ||
| 34 | - else | ||
| 35 | - callback(null, res, map) | ||
| 31 | + if (res == null) | ||
| 32 | + callback(null, source, map) | ||
| 33 | + else if (typeof res !== 'string') | ||
| 34 | + callback(null, res.code, res.map ?? map) | ||
| 35 | + else | ||
| 36 | + callback(null, res, map) | ||
| 37 | + } | ||
| 38 | + catch (error) { | ||
| 39 | + if (error instanceof Error) { | ||
| 40 | + callback(error) | ||
| 41 | + } | ||
| 42 | + else { | ||
| 43 | + callback(new Error(String(error))) | ||
| 44 | + } | ||
| 45 | + } | ||
| 36 | 46 | } | |
| Back | FazBrowse Home | New Git URL |
0 commit comments