Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@golemio/errors

Package Overview
Dependencies
Maintainers
5
Versions
81
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@golemio/errors - npm Package Compare versions

Comparing version 1.1.1 to 2.0.0-dev.875562719

dist/errors/AbstractGolemioError.d.ts

11

dist/index.d.ts

@@ -1,3 +0,8 @@

export * from "./CustomError";
export * from "./ErrorHandler";
export * from "./HTTPErrorHandler";
export * from "./errors/interfaces/GolemioErrorInterface";
export * from "./errors/AbstractGolemioError";
export * from "./errors/CustomError";
export * from "./errors/FatalError";
export * from "./errors/GeneralError";
export * from "./errors/UnprocessableError";
export * from "./handlers/ErrorHandler";
export * from "./handlers/HTTPErrorHandler";

@@ -17,5 +17,12 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("./CustomError"), exports);
__exportStar(require("./ErrorHandler"), exports);
__exportStar(require("./HTTPErrorHandler"), exports);
__exportStar(require("./errors/interfaces/GolemioErrorInterface"), exports);
/* errors */
__exportStar(require("./errors/AbstractGolemioError"), exports);
__exportStar(require("./errors/CustomError"), exports);
__exportStar(require("./errors/FatalError"), exports);
__exportStar(require("./errors/GeneralError"), exports);
__exportStar(require("./errors/UnprocessableError"), exports);
/* handlers */
__exportStar(require("./handlers/ErrorHandler"), exports);
__exportStar(require("./handlers/HTTPErrorHandler"), exports);
//# sourceMappingURL=index.js.map
{
"name": "@golemio/errors",
"version": "1.1.1",
"version": "2.0.0-dev.875562719",
"description": "Library of Error classes of the Golemio Data Platform System",

@@ -25,5 +25,5 @@ "main": "dist/index.js",

"engines": {
"node": ">=18.0.0",
"npm": ">=8.0.0"
},
"node": ">=18.0.0",
"npm": ">=8.0.0"
},
"devDependencies": {

@@ -40,3 +40,3 @@ "@types/chai": "^4.2.14",

"husky": "^4.3.0",
"mocha": "^8.2.1",
"mocha": "^10.2.0",
"npm-run-all": "^4.1.5",

@@ -43,0 +43,0 @@ "nyc": "^15.1.0",

@@ -55,6 +55,6 @@ # Golemio Errors Library

```
import { CustomError } from "@golemio/errors";
import { GeneralError } from "@golemio/errors";
```
Our CustomError has:
Our GeneralError has:

@@ -68,3 +68,3 @@ - whole stack trace of original `Error`

You can use CustomError class as you would a standard JavaScript Error, you will just get additional info and more capabilities:
You can use GeneralError class as you would a standard JavaScript Error, you will just get additional info and more capabilities:

@@ -74,3 +74,3 @@ ```

if (!found ) {
throw new CustomError("Id `" + id + "` not found", true, "MyModelClass", 404);
throw new GeneralError("Id `" + id + "` not found", "MyModelClass", undefined, 404);
}

@@ -86,3 +86,3 @@ ```

} catch (err) {
throw new CustomError("Database error", true, "MyModelClass", 500, err);
throw new GeneralError("Database error", "MyModelClass", err, 500);
}

@@ -95,3 +95,3 @@ ```

"MyModelClass" [500] Database error (ObjectParameterError: Parameter "filter" to find() must be an object, got nonsense)
CustomError: Database error
GeneralError: Database error
at MyModel.<anonymous> ({path}\src\core\models\MyModel.ts:65:19)

@@ -117,3 +117,3 @@ at Generator.throw (<anonymous>)

try {
await functionThatThrowsCustomError(); // Can throw our CustomError class
await functionThatThrowsGolemioError(); // Can throw our GolemioError class
await jsBuiltInFunction(); // Can throw a native built-in JavaScript Error

@@ -133,3 +133,3 @@ } catch (err) { // Catches everything

log.silly("Error caught by the router error handler.");
res.status(error.error_status || 500).send(error);
res.status(error.status || 500).send(error);
}

@@ -155,3 +155,3 @@ });

"error_status": 404,
"stack_trace": "CustomError: Id `nonsense` not found\n
"error_stack": "GeneralError: Id `nonsense` not found\n
at MyModel.<anonymous> ({path}y\\dist\\core\\models\\MyModel.js:116:23)\n

@@ -158,0 +158,0 @@ at Generator.next (<anonymous>)\n

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc