@pikokr/command.ts 3.0.6-dev.33d39ce → 3.0.6-dev.92a9148

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,6 @@
1
1
  export declare class ModuleLoadError extends Error {
2
- constructor(file: string);
2
+ error: Error;
3
+ constructor(file: string, error: Error);
3
4
  }
4
5
  export declare class InvalidModuleError extends Error {
5
6
  }
@@ -2,8 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.InvalidModuleError = exports.ModuleLoadError = void 0;
4
4
  class ModuleLoadError extends Error {
5
- constructor(file) {
5
+ constructor(file, error) {
6
6
  super('Failed to load module ' + file);
7
+ this.error = error;
7
8
  }
8
9
  }
9
10
  exports.ModuleLoadError = ModuleLoadError;
@@ -102,7 +102,7 @@ class Registry {
102
102
  m = require(p);
103
103
  }
104
104
  catch (e) {
105
- throw new error_1.ModuleLoadError(p);
105
+ throw new error_1.ModuleLoadError(p, e);
106
106
  }
107
107
  if (m.loaded)
108
108
  throw new Error('MODULE_ALREADY_LOADED');
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pikokr/command.ts",
3
3
  "description": "Discord.js command framework for typescript.",
4
- "version": "3.0.6-dev.33d39ce",
4
+ "version": "3.0.6-dev.92a9148",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "license": "MIT",
@@ -1,5 +1,5 @@
1
1
  export class ModuleLoadError extends Error {
2
- constructor(file: string) {
2
+ constructor(file: string, public error: Error) {
3
3
  super('Failed to load module ' + file)
4
4
  }
5
5
  }
@@ -95,7 +95,7 @@ export class Registry {
95
95
  try {
96
96
  m = require(p)
97
97
  } catch (e: any) {
98
- throw new ModuleLoadError(p)
98
+ throw new ModuleLoadError(p, e)
99
99
  }
100
100
 
101
101
  if (m.loaded) throw new Error('MODULE_ALREADY_LOADED')