You're Invited:Meet the Socket Team at RSAC and BSidesSF 2026, March 23–26.RSVP β†’
Socket
Book a DemoSign in
Socket

@webiny/error

Package Overview
Dependencies
Maintainers
1
Versions
571
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@webiny/error - npm Package Compare versions

Comparing version
0.0.0-unstable.7f63ea0744
to
0.0.0-unstable.81ae05e56b
+5
-12
Error.js

@@ -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 +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":[]}

@@ -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 };

@@ -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 +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":[]}
{
"name": "@webiny/error",
"version": "0.0.0-unstable.7f63ea0744",
"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.7f63ea0744",
"@webiny/project-utils": "^0.0.0-unstable.7f63ea0744",
"rimraf": "^3.0.2",
"ttypescript": "^1.5.15",
"typescript": "4.7.4"
},
"scripts": {
"build": "yarn webiny run build",
"watch": "yarn webiny run watch"
},
"gitHead": "7f63ea0744c9e31977e5dabb95538d22b4db585c"
"name": "@webiny/error",
"version": "0.0.0-unstable.81ae05e56b",
"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.81ae05e56b",
"rimraf": "6.1.3",
"typescript": "5.9.3"
},
"gitHead": "81ae05e56bcc774d1e077ca615a0005e736aa5a6"
}
# @webiny/error
[![](https://img.shields.io/npm/dw/webiny-data.svg)](https://www.npmjs.com/package/webiny-data)
[![](https://img.shields.io/npm/v/webiny-data.svg)](https://www.npmjs.com/package/webiny-data)
[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](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._