diff --git a/src/map.ts b/src/map.ts index d6a43cf..af39678 100644 --- a/src/map.ts +++ b/src/map.ts @@ -1,5 +1,6 @@ import { Struct } from './struct'; import { load } from './loader'; +import { extendErrorMessage } from './common'; // Store Loaded Structures const structures: Record = {}; @@ -20,11 +21,7 @@ export function getStructure(name: string) { // Return return target; } catch (e) { - let message = 'Error Loading ' + name; - if (e instanceof Error) { - message += ': ' + e.message; - } - throw new Error(message); + throw new Error(extendErrorMessage(e, 'Loading ' + name)); } } } \ No newline at end of file