@golemio/errors
Advanced tools
Comparing version 1.0.2-dev.368844540 to 1.0.2-dev.693846341
import { CustomError, ICustomErrorObject } from "./"; | ||
import { ILogger, LogLevels } from "./Logger"; | ||
/** | ||
@@ -16,7 +15,7 @@ * Class responsible for error handling in the app. Catches errors and based on their type performs some action. | ||
* @param {Error|CustomError} err object to catch and process | ||
* @param {LogLevels} logLevel log level method, default "error" | ||
* @param {ILogger} logger logger function, default internal Logger | ||
* @param {string} logLevel log level method, default "error" | ||
* @param {fn} logger logger function | ||
* @returns ICustomErrorObject | ||
*/ | ||
static handle(err: Error | CustomError, logLevel?: LogLevels, logger?: ILogger): ICustomErrorObject; | ||
static handle<Logger extends Record<any, any>>(err: Error | CustomError, logger: Logger, logLevel?: keyof Logger): ICustomErrorObject; | ||
} |
@@ -5,3 +5,2 @@ "use strict"; | ||
const _1 = require("./"); | ||
const Logger_1 = require("./Logger"); | ||
/** | ||
@@ -20,7 +19,7 @@ * Class responsible for error handling in the app. Catches errors and based on their type performs some action. | ||
* @param {Error|CustomError} err object to catch and process | ||
* @param {LogLevels} logLevel log level method, default "error" | ||
* @param {ILogger} logger logger function, default internal Logger | ||
* @param {string} logLevel log level method, default "error" | ||
* @param {fn} logger logger function | ||
* @returns ICustomErrorObject | ||
*/ | ||
static handle(err, logLevel = "error", logger = Logger_1.log) { | ||
static handle(err, logger, logLevel = "error") { | ||
if (err instanceof _1.CustomError && err.isOperational) { | ||
@@ -27,0 +26,0 @@ // log level for operational error is set dynamically, default level is `error` |
import { CustomError, ErrorHandler, ICustomErrorObject } from "./"; | ||
import { ILogger, LogLevels } from "./Logger"; | ||
/** | ||
@@ -16,7 +15,7 @@ * Class responsible for error handling in the app. Catches errors and based on their type performs some action. | ||
* @param {Error|CustomError} err object to catch and process | ||
* @param {LogLevels} logLevel log level method, default "error" | ||
* @param {ILogger} logger logger function, default internal Logger | ||
* @param {fn} logger logger function | ||
* @param {string} logLevel log level method, default "error" | ||
* @returns ICustomErrorObject | ||
*/ | ||
static handle(err: Error | CustomError, logLevel?: LogLevels, logger?: ILogger): ICustomErrorObject; | ||
static handle<Logger extends Record<any, any>>(err: Error | CustomError, logger: Logger, logLevel?: keyof Logger): ICustomErrorObject; | ||
} |
@@ -5,3 +5,2 @@ "use strict"; | ||
const _1 = require("./"); | ||
const Logger_1 = require("./Logger"); | ||
/** | ||
@@ -20,9 +19,9 @@ * Class responsible for error handling in the app. Catches errors and based on their type performs some action. | ||
* @param {Error|CustomError} err object to catch and process | ||
* @param {LogLevels} logLevel log level method, default "error" | ||
* @param {ILogger} logger logger function, default internal Logger | ||
* @param {fn} logger logger function | ||
* @param {string} logLevel log level method, default "error" | ||
* @returns ICustomErrorObject | ||
*/ | ||
static handle(err, logLevel = "error", logger = Logger_1.log) { | ||
static handle(err, logger, logLevel = "error") { | ||
// Call super to handle non-operational error | ||
const errObject = super.handle(err, logLevel, logger); | ||
const errObject = super.handle(err, logger, logLevel); | ||
let toReturn; | ||
@@ -29,0 +28,0 @@ // Define what to return to user |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
@@ -6,0 +10,0 @@ if (k2 === undefined) k2 = k; |
153
package.json
{ | ||
"name": "@golemio/errors", | ||
"version": "1.0.2-dev.368844540", | ||
"description": "Library of Error classes of the Golemio Data Platform System", | ||
"main": "dist/index.js", | ||
"types": "dist/index.d.ts", | ||
"scripts": { | ||
"prepublishOnly": "tsc", | ||
"build": "tsc", | ||
"build-watch": "tsc --watch --preserveWatchOutput", | ||
"test": "mocha --check-leaks --timeout 60000 -r ts-node/register -r dotenv/config --recursive test/*.test.ts --exit", | ||
"test-debug": "mocha --inspect-brk=9230 -b --check-leaks --timeout 60000 -r ts-node/register -r dotenv/config --recursive test/*.test.ts --exit", | ||
"code-coverage": "nyc mocha --check-leaks --timeout 60000 -r ts-node/register -r source-map-support/register -r dotenv/config --recursive test/*.test.ts --exit", | ||
"lint": "tslint -p .", | ||
"generate-docs": "typedoc --out docs/typedoc src" | ||
}, | ||
"keywords": [], | ||
"author": "Operator ICT, a.s.", | ||
"license": "MIT", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://gitlab.com/operator-ict/golemio/code/errors" | ||
}, | ||
"devDependencies": { | ||
"@types/chai": "^4.2.14", | ||
"@types/chai-as-promised": "^7.1.3", | ||
"@types/debug": "^4.1.5", | ||
"@types/mocha": "^8.0.4", | ||
"@types/node": "^12.12.6", | ||
"@types/sinon": "^9.0.8", | ||
"chai": "^4.2.0", | ||
"chai-as-promised": "^7.1.1", | ||
"husky": "^4.3.0", | ||
"mocha": "^8.2.1", | ||
"nyc": "^15.1.0", | ||
"sinon": "^9.2.1", | ||
"ts-node": "^9.0.0", | ||
"tslint": "5.11.0", | ||
"typedoc": "^0.20.28", | ||
"typescript": "^4.0.5" | ||
}, | ||
"dependencies": { | ||
"debug": "^4.2.0", | ||
"dotenv": "^8.2.0", | ||
"winston": "^3.3.3" | ||
}, | ||
"nyc": { | ||
"check-coverage": true, | ||
"extension": [ | ||
".ts", | ||
".tsx" | ||
], | ||
"exclude": [ | ||
"**/*.d.ts", | ||
"dist", | ||
"**/*.test.ts", | ||
"coverage", | ||
"docs", | ||
"node_modules", | ||
"src/Logger.ts" | ||
], | ||
"reporter": [ | ||
"text", | ||
"lcov" | ||
], | ||
"all": true, | ||
"lines": 0, | ||
"statements": 0, | ||
"functions": 0, | ||
"branches": 0 | ||
}, | ||
"husky": { | ||
"hooks": { | ||
"pre-commit": "npm run tslint" | ||
} | ||
} | ||
"name": "@golemio/errors", | ||
"version": "1.0.2-dev.693846341", | ||
"description": "Library of Error classes of the Golemio Data Platform System", | ||
"main": "dist/index.js", | ||
"types": "dist/index.d.ts", | ||
"scripts": { | ||
"prepublishOnly": "tsc", | ||
"build": "tsc", | ||
"build-watch": "tsc --watch --preserveWatchOutput", | ||
"test": "cross-env NODE_ENV=test TS_NODE_COMPILER='ttypescript' mocha --exit --check-leaks --timeout 120000 -r ts-node/register -r dotenv/config 'test/**/*.test.ts'", | ||
"test-debug": "run-s 'test --inspect-brk=9230'", | ||
"code-coverage": "nyc run-s 'test -r source-map-support/register'", | ||
"lint": "tslint -p .", | ||
"generate-docs": "typedoc --out docs/typedoc src" | ||
}, | ||
"keywords": [], | ||
"author": "Operator ICT, a.s.", | ||
"license": "MIT", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://gitlab.com/operator-ict/golemio/code/errors" | ||
}, | ||
"devDependencies": { | ||
"@types/chai": "^4.2.14", | ||
"@types/chai-as-promised": "^7.1.3", | ||
"@types/debug": "^4.1.5", | ||
"@types/mocha": "^8.0.4", | ||
"@types/node": "^12.12.6", | ||
"@types/sinon": "^9.0.8", | ||
"chai": "^4.2.0", | ||
"chai-as-promised": "^7.1.1", | ||
"cross-env": "^7.0.3", | ||
"husky": "^4.3.0", | ||
"mocha": "^8.2.1", | ||
"npm-run-all": "^4.1.5", | ||
"nyc": "^15.1.0", | ||
"sinon": "^9.2.1", | ||
"ts-node": "^10.9.1", | ||
"tslint": "5.11.0", | ||
"ttypescript": "^1.5.13", | ||
"typedoc": "^0.22.15", | ||
"typescript": "4.7.2" | ||
}, | ||
"dependencies": { | ||
"debug": "^4.2.0", | ||
"dotenv": "^8.2.0", | ||
"pino": "^8.7.0" | ||
}, | ||
"nyc": { | ||
"check-coverage": true, | ||
"extension": [ | ||
".ts", | ||
".tsx" | ||
], | ||
"exclude": [ | ||
"**/*.d.ts", | ||
"dist", | ||
"**/*.test.ts", | ||
"coverage", | ||
"docs", | ||
"node_modules", | ||
"src/Logger.ts" | ||
], | ||
"reporter": [ | ||
"text", | ||
"lcov" | ||
], | ||
"all": true, | ||
"lines": 0, | ||
"statements": 0, | ||
"functions": 0, | ||
"branches": 0 | ||
}, | ||
"husky": { | ||
"hooks": { | ||
"pre-commit": "npm run lint" | ||
} | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
35102
19
18
466
+ Addedpino@^8.7.0
+ Addedabort-controller@3.0.0(transitive)
+ Addedatomic-sleep@1.0.0(transitive)
+ Addedbase64-js@1.5.1(transitive)
+ Addedbuffer@6.0.3(transitive)
+ Addedevent-target-shim@5.0.1(transitive)
+ Addedevents@3.3.0(transitive)
+ Addedfast-redact@3.5.0(transitive)
+ Addedieee754@1.2.1(transitive)
+ Addedon-exit-leak-free@2.1.2(transitive)
+ Addedpino@8.21.0(transitive)
+ Addedpino-abstract-transport@1.2.0(transitive)
+ Addedpino-std-serializers@6.2.2(transitive)
+ Addedprocess@0.11.10(transitive)
+ Addedprocess-warning@3.0.0(transitive)
+ Addedquick-format-unescaped@4.0.4(transitive)
+ Addedreadable-stream@4.7.0(transitive)
+ Addedreal-require@0.2.0(transitive)
+ Addedsonic-boom@3.8.1(transitive)
+ Addedsplit2@4.2.0(transitive)
+ Addedthread-stream@2.7.0(transitive)
- Removedwinston@^3.3.3
- Removed@colors/colors@1.6.0(transitive)
- Removed@dabh/diagnostics@2.0.3(transitive)
- Removed@types/triple-beam@1.3.5(transitive)
- Removedasync@3.2.6(transitive)
- Removedcolor@3.2.1(transitive)
- Removedcolor-convert@1.9.3(transitive)
- Removedcolor-name@1.1.3(transitive)
- Removedcolor-string@1.9.1(transitive)
- Removedcolorspace@1.1.4(transitive)
- Removedenabled@2.0.0(transitive)
- Removedfecha@4.2.3(transitive)
- Removedfn.name@1.1.0(transitive)
- Removedinherits@2.0.4(transitive)
- Removedis-arrayish@0.3.2(transitive)
- Removedis-stream@2.0.1(transitive)
- Removedkuler@2.0.0(transitive)
- Removedlogform@2.7.0(transitive)
- Removedone-time@1.0.0(transitive)
- Removedreadable-stream@3.6.2(transitive)
- Removedsimple-swizzle@0.2.2(transitive)
- Removedstack-trace@0.0.10(transitive)
- Removedtext-hex@1.0.0(transitive)
- Removedtriple-beam@1.4.1(transitive)
- Removedutil-deprecate@1.0.2(transitive)
- Removedwinston@3.17.0(transitive)
- Removedwinston-transport@4.9.0(transitive)