error-message-utils 1.2.3 → 1.2.4
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.
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type IErrorCode } from '../shared/types.js';
|
|
2
2
|
export declare class Exception extends Error {
|
|
3
3
|
readonly code: IErrorCode;
|
|
4
|
-
constructor(error: unknown, code
|
|
4
|
+
constructor(error: unknown, code?: IErrorCode);
|
|
5
5
|
/**
|
|
6
6
|
* Override the default toString method to return a formatted error message with the code.
|
|
7
7
|
* @returns A string representation of the error with the code.
|
package/dist/exception/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{encodeError
|
|
1
|
+
import{decodeError,encodeError}from"../error-handler/index.js";export class Exception extends Error{code;constructor(r,e){const o=decodeError(r);super(o.message),this.name="Exception",this.code=e??o.code}toString(){return encodeError(this.message,this.code)}[Symbol.toPrimitive](r){return"string"===r||"default"===r?this.toString():null}}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "error-message-utils",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.4",
|
|
4
4
|
"description": "The error-message-utils package simplifies error management in your web applications and RESTful APIs. It ensures consistent and scalable handling of error messages, saving you time and effort. Moreover, it gives you the ability to assign custom error codes so all possible cases can be handled accordingly.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|