@webiny/error 0.0.0-unstable.fcdad0bc61 → 0.0.0-unstable.fdd9228b5d

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.
package/Error.js CHANGED
@@ -1,21 +1,15 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
-
5
3
  Object.defineProperty(exports, "__esModule", {
6
4
  value: true
7
5
  });
8
6
  exports.default = void 0;
9
-
10
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
-
12
7
  class WError extends Error {
8
+ code = null;
9
+ data = null;
13
10
  constructor(messageOrOptions, code, data) {
14
11
  // TODO in TS 4.6 we can move that into if statements
15
12
  super(typeof messageOrOptions === "string" ? messageOrOptions : messageOrOptions.message);
16
- (0, _defineProperty2.default)(this, "code", null);
17
- (0, _defineProperty2.default)(this, "data", null);
18
-
19
13
  if (typeof messageOrOptions === "string") {
20
14
  // super(messageOrOptions); - use after TS 4.6
21
15
  this.code = code || null;
@@ -26,7 +20,6 @@ class WError extends Error {
26
20
  this.data = messageOrOptions.data || null;
27
21
  }
28
22
  }
29
-
30
23
  static from(err, options = {}) {
31
24
  return new WError({
32
25
  message: err.message || options.message,
@@ -34,7 +27,7 @@ class WError extends Error {
34
27
  data: Object.assign({}, err.data, options.data)
35
28
  });
36
29
  }
37
-
38
30
  }
31
+ exports.default = WError;
39
32
 
40
- exports.default = WError;
33
+ //# sourceMappingURL=Error.js.map
package/Error.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["WError","Error","constructor","messageOrOptions","code","data","message","from","err","options","Object","assign"],"sources":["Error.ts"],"sourcesContent":["export interface ErrorOptions<TData = any> {\n message?: string;\n code?: string;\n data?: TData;\n}\n\nexport default class WError<TData = any> extends Error {\n public readonly code: string | null = null;\n public readonly data: TData | null = null;\n\n constructor(message: string, code?: string, data?: TData);\n constructor(options: ErrorOptions<TData>);\n constructor(messageOrOptions: string | ErrorOptions<TData>, code?: string, data?: TData) {\n // TODO in TS 4.6 we can move that into if statements\n super(typeof messageOrOptions === \"string\" ? messageOrOptions : messageOrOptions.message);\n\n if (typeof messageOrOptions === \"string\") {\n // super(messageOrOptions); - use after TS 4.6\n this.code = code || null;\n this.data = data || null;\n } else {\n // super(messageOrOptions.message); - use after TS 4.6\n this.code = messageOrOptions.code || null;\n this.data = messageOrOptions.data || null;\n }\n }\n\n public static from<TData = any>(err: Partial<WError>, options: ErrorOptions<TData> = {}) {\n return new WError({\n message: err.message || options.message,\n code: err.code || options.code,\n data: Object.assign({}, err.data, options.data)\n });\n }\n}\n"],"mappings":";;;;;;;;;;;AAMe,MAAMA,MAAN,SAAkCC,KAAlC,CAAwC;EAMnDC,WAAW,CAACC,gBAAD,EAAiDC,IAAjD,EAAgEC,IAAhE,EAA8E;IACrF;IACA,MAAM,OAAOF,gBAAP,KAA4B,QAA5B,GAAuCA,gBAAvC,GAA0DA,gBAAgB,CAACG,OAAjF;IAFqF,4CALnD,IAKmD;IAAA,4CAJpD,IAIoD;;IAIrF,IAAI,OAAOH,gBAAP,KAA4B,QAAhC,EAA0C;MACtC;MACA,KAAKC,IAAL,GAAYA,IAAI,IAAI,IAApB;MACA,KAAKC,IAAL,GAAYA,IAAI,IAAI,IAApB;IACH,CAJD,MAIO;MACH;MACA,KAAKD,IAAL,GAAYD,gBAAgB,CAACC,IAAjB,IAAyB,IAArC;MACA,KAAKC,IAAL,GAAYF,gBAAgB,CAACE,IAAjB,IAAyB,IAArC;IACH;EACJ;;EAEiB,OAAJE,IAAI,CAAcC,GAAd,EAAoCC,OAA4B,GAAG,EAAnE,EAAuE;IACrF,OAAO,IAAIT,MAAJ,CAAW;MACdM,OAAO,EAAEE,GAAG,CAACF,OAAJ,IAAeG,OAAO,CAACH,OADlB;MAEdF,IAAI,EAAEI,GAAG,CAACJ,IAAJ,IAAYK,OAAO,CAACL,IAFZ;MAGdC,IAAI,EAAEK,MAAM,CAACC,MAAP,CAAc,EAAd,EAAkBH,GAAG,CAACH,IAAtB,EAA4BI,OAAO,CAACJ,IAApC;IAHQ,CAAX,CAAP;EAKH;;AA3BkD"}
1
+ {"version":3,"names":["WError","Error","code","data","constructor","messageOrOptions","message","from","err","options","Object","assign","exports","default"],"sources":["Error.ts"],"sourcesContent":["export interface ErrorOptions<TData = any> {\n message?: string;\n code?: string;\n data?: TData;\n}\n\nexport default class WError<TData = any> extends Error {\n public readonly code: string | null = null;\n public readonly data: TData | null = null;\n\n constructor(message: string, code?: string, data?: TData);\n constructor(options: ErrorOptions<TData>);\n constructor(messageOrOptions: string | ErrorOptions<TData>, code?: string, data?: TData) {\n // TODO in TS 4.6 we can move that into if statements\n super(typeof messageOrOptions === \"string\" ? messageOrOptions : messageOrOptions.message);\n\n if (typeof messageOrOptions === \"string\") {\n // super(messageOrOptions); - use after TS 4.6\n this.code = code || null;\n this.data = data || null;\n } else {\n // super(messageOrOptions.message); - use after TS 4.6\n this.code = messageOrOptions.code || null;\n this.data = messageOrOptions.data || null;\n }\n }\n\n public static from<TData = any>(err: Partial<WError>, options: ErrorOptions<TData> = {}) {\n return new WError({\n message: err.message || options.message,\n code: err.code || options.code,\n data: Object.assign({}, err.data, options.data)\n });\n }\n}\n"],"mappings":";;;;;;AAMe,MAAMA,MAAM,SAAsBC,KAAK,CAAC;EACnCC,IAAI,GAAkB,IAAI;EAC1BC,IAAI,GAAiB,IAAI;EAIzCC,WAAWA,CAACC,gBAA8C,EAAEH,IAAa,EAAEC,IAAY,EAAE;IACrF;IACA,KAAK,CAAC,OAAOE,gBAAgB,KAAK,QAAQ,GAAGA,gBAAgB,GAAGA,gBAAgB,CAACC,OAAO,CAAC;IAEzF,IAAI,OAAOD,gBAAgB,KAAK,QAAQ,EAAE;MACtC;MACA,IAAI,CAACH,IAAI,GAAGA,IAAI,IAAI,IAAI;MACxB,IAAI,CAACC,IAAI,GAAGA,IAAI,IAAI,IAAI;IAC5B,CAAC,MAAM;MACH;MACA,IAAI,CAACD,IAAI,GAAGG,gBAAgB,CAACH,IAAI,IAAI,IAAI;MACzC,IAAI,CAACC,IAAI,GAAGE,gBAAgB,CAACF,IAAI,IAAI,IAAI;IAC7C;EACJ;EAEA,OAAcI,IAAIA,CAAcC,GAAoB,EAAEC,OAA4B,GAAG,CAAC,CAAC,EAAE;IACrF,OAAO,IAAIT,MAAM,CAAC;MACdM,OAAO,EAAEE,GAAG,CAACF,OAAO,IAAIG,OAAO,CAACH,OAAO;MACvCJ,IAAI,EAAEM,GAAG,CAACN,IAAI,IAAIO,OAAO,CAACP,IAAI;MAC9BC,IAAI,EAAEO,MAAM,CAACC,MAAM,CAAC,CAAC,CAAC,EAAEH,GAAG,CAACL,IAAI,EAAEM,OAAO,CAACN,IAAI;IAClD,CAAC,CAAC;EACN;AACJ;AAACS,OAAA,CAAAC,OAAA,GAAAb,MAAA","ignoreList":[]}
package/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  import Error, { ErrorOptions } from "./Error";
2
+ export { Error as WebinyError };
2
3
  export default Error;
3
4
  export { ErrorOptions };
package/index.js CHANGED
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
@@ -11,9 +10,14 @@ Object.defineProperty(exports, "ErrorOptions", {
11
10
  return _Error.ErrorOptions;
12
11
  }
13
12
  });
13
+ Object.defineProperty(exports, "WebinyError", {
14
+ enumerable: true,
15
+ get: function () {
16
+ return _Error.default;
17
+ }
18
+ });
14
19
  exports.default = void 0;
15
-
16
20
  var _Error = _interopRequireWildcard(require("./Error"));
21
+ var _default = exports.default = _Error.default;
17
22
 
18
- var _default = _Error.default;
19
- exports.default = _default;
23
+ //# sourceMappingURL=index.js.map
package/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["Error"],"sources":["index.ts"],"sourcesContent":["import Error, { ErrorOptions } from \"./Error\";\n\nexport default Error;\nexport { ErrorOptions };\n"],"mappings":";;;;;;;;;;;;;;;AAAA;;eAEeA,c"}
1
+ {"version":3,"names":["_Error","_interopRequireWildcard","require","_default","exports","default","Error"],"sources":["index.ts"],"sourcesContent":["import Error, { ErrorOptions } from \"./Error\";\n\nexport { Error as WebinyError };\nexport default Error;\nexport { ErrorOptions };\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAA8C,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAG/BC,cAAK","ignoreList":[]}
package/package.json CHANGED
@@ -1,29 +1,26 @@
1
1
  {
2
- "name": "@webiny/error",
3
- "version": "0.0.0-unstable.fcdad0bc61",
4
- "main": "index.js",
5
- "types": "index.d.ts",
6
- "repository": {
7
- "type": "git",
8
- "url": "https://github.com/webiny/webiny-js.git"
9
- },
10
- "description": "A simple multi-database client.",
11
- "license": "MIT",
12
- "publishConfig": {
13
- "access": "public",
14
- "directory": "dist"
15
- },
16
- "devDependencies": {
17
- "@babel/cli": "^7.19.3",
18
- "@babel/core": "^7.19.3",
19
- "@webiny/cli": "^0.0.0-unstable.fcdad0bc61",
20
- "@webiny/project-utils": "^0.0.0-unstable.fcdad0bc61",
21
- "rimraf": "^3.0.2",
22
- "typescript": "4.7.4"
23
- },
24
- "scripts": {
25
- "build": "yarn webiny run build",
26
- "watch": "yarn webiny run watch"
27
- },
28
- "gitHead": "40d639c3665e384a5e2d26674d43ce26f3295e8c"
2
+ "name": "@webiny/error",
3
+ "version": "0.0.0-unstable.fdd9228b5d",
4
+ "main": "index.js",
5
+ "types": "index.d.ts",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/webiny/webiny-js.git"
9
+ },
10
+ "description": "A simple multi-database client.",
11
+ "license": "MIT",
12
+ "publishConfig": {
13
+ "access": "public",
14
+ "directory": "dist"
15
+ },
16
+ "devDependencies": {
17
+ "@webiny/project-utils": "0.0.0-unstable.fdd9228b5d",
18
+ "rimraf": "6.0.1",
19
+ "typescript": "5.3.3"
20
+ },
21
+ "scripts": {
22
+ "build": "node ../cli/bin.js run build",
23
+ "watch": "node ../cli/bin.js run watch"
24
+ },
25
+ "gitHead": "fdd9228b5d2636463e8a34b6e0d26eea1e29c01d"
29
26
  }