@webiny/error
Advanced tools
+5
-12
@@ -1,15 +0,7 @@ | ||
| "use strict"; | ||
| var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default; | ||
| Object.defineProperty(exports, "__esModule", { | ||
| value: true | ||
| }); | ||
| exports.default = void 0; | ||
| var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); | ||
| class WError extends Error { | ||
| export default class WError extends Error { | ||
| code = null; | ||
| data = null; | ||
| constructor(messageOrOptions, code, data) { | ||
| // TODO in TS 4.6 we can move that into if statements | ||
| super(typeof messageOrOptions === "string" ? messageOrOptions : messageOrOptions.message); | ||
| (0, _defineProperty2.default)(this, "code", null); | ||
| (0, _defineProperty2.default)(this, "data", null); | ||
| if (typeof messageOrOptions === "string") { | ||
@@ -33,2 +25,3 @@ // super(messageOrOptions); - use after TS 4.6 | ||
| } | ||
| exports.default = WError; | ||
| //# sourceMappingURL=Error.js.map |
+1
-1
@@ -1,1 +0,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,MAAM,SAAsBC,KAAK,CAAC;EAMnDC,WAAW,CAACC,gBAA8C,EAAEC,IAAa,EAAEC,IAAY,EAAE;IACrF;IACA,KAAK,CAAC,OAAOF,gBAAgB,KAAK,QAAQ,GAAGA,gBAAgB,GAAGA,gBAAgB,CAACG,OAAO,CAAC;IAAC,4CAPxD,IAAI;IAAA,4CACL,IAAI;IAQrC,IAAI,OAAOH,gBAAgB,KAAK,QAAQ,EAAE;MACtC;MACA,IAAI,CAACC,IAAI,GAAGA,IAAI,IAAI,IAAI;MACxB,IAAI,CAACC,IAAI,GAAGA,IAAI,IAAI,IAAI;IAC5B,CAAC,MAAM;MACH;MACA,IAAI,CAACD,IAAI,GAAGD,gBAAgB,CAACC,IAAI,IAAI,IAAI;MACzC,IAAI,CAACC,IAAI,GAAGF,gBAAgB,CAACE,IAAI,IAAI,IAAI;IAC7C;EACJ;EAEA,OAAcE,IAAI,CAAcC,GAAoB,EAAEC,OAA4B,GAAG,CAAC,CAAC,EAAE;IACrF,OAAO,IAAIT,MAAM,CAAC;MACdM,OAAO,EAAEE,GAAG,CAACF,OAAO,IAAIG,OAAO,CAACH,OAAO;MACvCF,IAAI,EAAEI,GAAG,CAACJ,IAAI,IAAIK,OAAO,CAACL,IAAI;MAC9BC,IAAI,EAAEK,MAAM,CAACC,MAAM,CAAC,CAAC,CAAC,EAAEH,GAAG,CAACH,IAAI,EAAEI,OAAO,CAACJ,IAAI;IAClD,CAAC,CAAC;EACN;AACJ;AAAC"} | ||
| {"version":3,"names":["WError","Error","code","data","constructor","messageOrOptions","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":"AAMA,eAAe,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","ignoreList":[]} |
+3
-2
@@ -1,3 +0,4 @@ | ||
| import Error, { ErrorOptions } from "./Error"; | ||
| import Error, { type ErrorOptions } from "./Error.js"; | ||
| export { Error as WebinyError }; | ||
| export default Error; | ||
| export { ErrorOptions }; | ||
| export type { ErrorOptions }; |
+4
-15
@@ -1,16 +0,5 @@ | ||
| "use strict"; | ||
| import Error from "./Error.js"; | ||
| export { Error as WebinyError }; | ||
| export default Error; | ||
| var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default; | ||
| Object.defineProperty(exports, "__esModule", { | ||
| value: true | ||
| }); | ||
| Object.defineProperty(exports, "ErrorOptions", { | ||
| enumerable: true, | ||
| get: function () { | ||
| return _Error.ErrorOptions; | ||
| } | ||
| }); | ||
| exports.default = void 0; | ||
| var _Error = _interopRequireWildcard(require("./Error")); | ||
| var _default = _Error.default; | ||
| exports.default = _default; | ||
| //# sourceMappingURL=index.js.map |
+1
-1
@@ -1,1 +0,1 @@ | ||
| {"version":3,"names":["Error"],"sources":["index.ts"],"sourcesContent":["import Error, { ErrorOptions } from \"./Error\";\n\nexport default Error;\nexport { ErrorOptions };\n"],"mappings":";;;;;;;;;;;;;AAAA;AAA8C,eAE/BA,cAAK;AAAA"} | ||
| {"version":3,"names":["Error","WebinyError"],"sources":["index.ts"],"sourcesContent":["import Error, { type ErrorOptions } from \"./Error.js\";\n\nexport { Error as WebinyError };\nexport default Error;\nexport type { ErrorOptions };\n"],"mappings":"AAAA,OAAOA,KAAK;AAEZ,SAASA,KAAK,IAAIC,WAAW;AAC7B,eAAeD,KAAK","ignoreList":[]} |
+21
-28
| { | ||
| "name": "@webiny/error", | ||
| "version": "0.0.0-unstable.c2780f51fe", | ||
| "main": "index.js", | ||
| "types": "index.d.ts", | ||
| "repository": { | ||
| "type": "git", | ||
| "url": "https://github.com/webiny/webiny-js.git" | ||
| }, | ||
| "description": "A simple multi-database client.", | ||
| "license": "MIT", | ||
| "publishConfig": { | ||
| "access": "public", | ||
| "directory": "dist" | ||
| }, | ||
| "devDependencies": { | ||
| "@babel/cli": "^7.19.3", | ||
| "@babel/core": "^7.19.3", | ||
| "@webiny/cli": "^0.0.0-unstable.c2780f51fe", | ||
| "@webiny/project-utils": "^0.0.0-unstable.c2780f51fe", | ||
| "rimraf": "^3.0.2", | ||
| "ttypescript": "^1.5.15", | ||
| "typescript": "4.7.4" | ||
| }, | ||
| "scripts": { | ||
| "build": "yarn webiny run build", | ||
| "watch": "yarn webiny run watch" | ||
| }, | ||
| "gitHead": "c2780f51fe628e1ef0f6b55c2bce9b74d3470d79" | ||
| "name": "@webiny/error", | ||
| "version": "0.0.0-unstable.c27f4d8a31", | ||
| "type": "module", | ||
| "main": "index.js", | ||
| "types": "index.d.ts", | ||
| "repository": { | ||
| "type": "git", | ||
| "url": "https://github.com/webiny/webiny-js.git" | ||
| }, | ||
| "description": "A simple multi-database client.", | ||
| "license": "MIT", | ||
| "publishConfig": { | ||
| "access": "public", | ||
| "directory": "dist" | ||
| }, | ||
| "devDependencies": { | ||
| "@webiny/build-tools": "0.0.0-unstable.c27f4d8a31", | ||
| "rimraf": "6.1.3", | ||
| "typescript": "5.9.3" | ||
| }, | ||
| "gitHead": "c27f4d8a31c3af1570817797441855292b6c1f20" | ||
| } |
+7
-16
| # @webiny/error | ||
| [](https://www.npmjs.com/package/webiny-data) | ||
| [](https://www.npmjs.com/package/webiny-data) | ||
| [](https://github.com/prettier/prettier) | ||
| [](http://makeapullrequest.com) | ||
| A set of frequently used data higher order functions. | ||
| > [!NOTE] | ||
| > This package is part of the [Webiny](https://www.webiny.com) monorepo. | ||
| > Itβs **included in every Webiny project by default** and is not meant to be used as a standalone package. | ||
| For more information, please visit | ||
| [the official docs](https://github.com/doitadrian/data). | ||
| ## Install | ||
| ``` | ||
| npm install --save @webiny/error | ||
| ``` | ||
| π **Documentation:** [https://www.webiny.com/docs](https://www.webiny.com/docs) | ||
| Or if you prefer yarn: | ||
| ``` | ||
| yarn add @webiny/error | ||
| ``` | ||
| --- | ||
| _This README file is automatically generated during the publish process._ |
3
-57.14%Yes
NaN6255
-15.2%43
-28.33%11
-47.62%