@naman_deep_singh/errors-utils 1.3.2 → 1.3.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.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  @naman_deep_singh/errors-utils
2
2
 
3
- Version: 1.3.2
3
+ Version: 1.3.4
4
4
 
5
5
  A standardized, code-driven error handling system for TypeScript and Express applications, providing consistent error identity, responses, and middleware integration.
6
6
 
@@ -1,4 +1,4 @@
1
- import { UnauthorizedError } from './UnauthorizedError';
2
- export declare class TokenExpiredError extends UnauthorizedError {
1
+ import { HTTPError } from './HTTPError';
2
+ export declare class TokenExpiredError extends HTTPError {
3
3
  constructor(details?: unknown, cause?: Error);
4
4
  }
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.TokenExpiredError = void 0;
4
4
  const response_utils_1 = require("@naman_deep_singh/response-utils");
5
5
  const constants_1 = require("src/constants");
6
- const UnauthorizedError_1 = require("./UnauthorizedError");
7
- class TokenExpiredError extends UnauthorizedError_1.UnauthorizedError {
6
+ const HTTPError_1 = require("./HTTPError");
7
+ class TokenExpiredError extends HTTPError_1.HTTPError {
8
8
  constructor(details, cause) {
9
9
  super(constants_1.ERROR_CODES.TOKEN_EXPIRED, response_utils_1.HTTP_STATUS.CLIENT_ERROR.UNAUTHORIZED, details, cause);
10
10
  }
@@ -1,4 +1,4 @@
1
- import { UnauthorizedError } from './UnauthorizedError';
2
- export declare class TokenMalformedError extends UnauthorizedError {
1
+ import { HTTPError } from './HTTPError';
2
+ export declare class TokenMalformedError extends HTTPError {
3
3
  constructor(details?: unknown, cause?: Error);
4
4
  }
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.TokenMalformedError = void 0;
4
4
  const response_utils_1 = require("@naman_deep_singh/response-utils");
5
5
  const constants_1 = require("src/constants");
6
- const UnauthorizedError_1 = require("./UnauthorizedError");
7
- class TokenMalformedError extends UnauthorizedError_1.UnauthorizedError {
6
+ const HTTPError_1 = require("./HTTPError");
7
+ class TokenMalformedError extends HTTPError_1.HTTPError {
8
8
  constructor(details, cause) {
9
9
  super(constants_1.ERROR_CODES.TOKEN_INVALID, response_utils_1.HTTP_STATUS.CLIENT_ERROR.UNAUTHORIZED, details, cause);
10
10
  }
@@ -1,5 +1,4 @@
1
- import { type ErrorCode } from 'src/constants';
2
1
  import { HTTPError } from './HTTPError';
3
2
  export declare class UnauthorizedError extends HTTPError {
4
- constructor(errorCodes?: ErrorCode, status?: number, details?: unknown, cause?: Error);
3
+ constructor(details?: unknown, cause?: Error);
5
4
  }
@@ -5,8 +5,8 @@ const response_utils_1 = require("@naman_deep_singh/response-utils");
5
5
  const constants_1 = require("src/constants");
6
6
  const HTTPError_1 = require("./HTTPError");
7
7
  class UnauthorizedError extends HTTPError_1.HTTPError {
8
- constructor(errorCodes = constants_1.ERROR_CODES.UNAUTHORIZED, status = response_utils_1.HTTP_STATUS.CLIENT_ERROR.UNAUTHORIZED, details, cause) {
9
- super(errorCodes, status, details, cause);
8
+ constructor(details, cause) {
9
+ super(constants_1.ERROR_CODES.UNAUTHORIZED, response_utils_1.HTTP_STATUS.CLIENT_ERROR.UNAUTHORIZED, details, cause);
10
10
  }
11
11
  }
12
12
  exports.UnauthorizedError = UnauthorizedError;
@@ -1,4 +1,4 @@
1
- import { UnauthorizedError } from './UnauthorizedError';
2
- export declare class TokenExpiredError extends UnauthorizedError {
1
+ import { HTTPError } from './HTTPError';
2
+ export declare class TokenExpiredError extends HTTPError {
3
3
  constructor(details?: unknown, cause?: Error);
4
4
  }
@@ -1,7 +1,7 @@
1
1
  import { HTTP_STATUS } from '@naman_deep_singh/response-utils';
2
2
  import { ERROR_CODES } from 'src/constants';
3
- import { UnauthorizedError } from './UnauthorizedError';
4
- export class TokenExpiredError extends UnauthorizedError {
3
+ import { HTTPError } from './HTTPError';
4
+ export class TokenExpiredError extends HTTPError {
5
5
  constructor(details, cause) {
6
6
  super(ERROR_CODES.TOKEN_EXPIRED, HTTP_STATUS.CLIENT_ERROR.UNAUTHORIZED, details, cause);
7
7
  }
@@ -1,4 +1,4 @@
1
- import { UnauthorizedError } from './UnauthorizedError';
2
- export declare class TokenMalformedError extends UnauthorizedError {
1
+ import { HTTPError } from './HTTPError';
2
+ export declare class TokenMalformedError extends HTTPError {
3
3
  constructor(details?: unknown, cause?: Error);
4
4
  }
@@ -1,7 +1,7 @@
1
1
  import { HTTP_STATUS } from '@naman_deep_singh/response-utils';
2
2
  import { ERROR_CODES } from 'src/constants';
3
- import { UnauthorizedError } from './UnauthorizedError';
4
- export class TokenMalformedError extends UnauthorizedError {
3
+ import { HTTPError } from './HTTPError';
4
+ export class TokenMalformedError extends HTTPError {
5
5
  constructor(details, cause) {
6
6
  super(ERROR_CODES.TOKEN_INVALID, HTTP_STATUS.CLIENT_ERROR.UNAUTHORIZED, details, cause);
7
7
  }
@@ -1,5 +1,4 @@
1
- import { type ErrorCode } from 'src/constants';
2
1
  import { HTTPError } from './HTTPError';
3
2
  export declare class UnauthorizedError extends HTTPError {
4
- constructor(errorCodes?: ErrorCode, status?: number, details?: unknown, cause?: Error);
3
+ constructor(details?: unknown, cause?: Error);
5
4
  }
@@ -2,7 +2,7 @@ import { HTTP_STATUS } from '@naman_deep_singh/response-utils';
2
2
  import { ERROR_CODES } from 'src/constants';
3
3
  import { HTTPError } from './HTTPError';
4
4
  export class UnauthorizedError extends HTTPError {
5
- constructor(errorCodes = ERROR_CODES.UNAUTHORIZED, status = HTTP_STATUS.CLIENT_ERROR.UNAUTHORIZED, details, cause) {
6
- super(errorCodes, status, details, cause);
5
+ constructor(details, cause) {
6
+ super(ERROR_CODES.UNAUTHORIZED, HTTP_STATUS.CLIENT_ERROR.UNAUTHORIZED, details, cause);
7
7
  }
8
8
  }
@@ -1,4 +1,4 @@
1
- import { UnauthorizedError } from './UnauthorizedError';
2
- export declare class TokenExpiredError extends UnauthorizedError {
1
+ import { HTTPError } from './HTTPError';
2
+ export declare class TokenExpiredError extends HTTPError {
3
3
  constructor(details?: unknown, cause?: Error);
4
4
  }
@@ -1,4 +1,4 @@
1
- import { UnauthorizedError } from './UnauthorizedError';
2
- export declare class TokenMalformedError extends UnauthorizedError {
1
+ import { HTTPError } from './HTTPError';
2
+ export declare class TokenMalformedError extends HTTPError {
3
3
  constructor(details?: unknown, cause?: Error);
4
4
  }
@@ -1,5 +1,4 @@
1
- import { type ErrorCode } from 'src/constants';
2
1
  import { HTTPError } from './HTTPError';
3
2
  export declare class UnauthorizedError extends HTTPError {
4
- constructor(errorCodes?: ErrorCode, status?: number, details?: unknown, cause?: Error);
3
+ constructor(details?: unknown, cause?: Error);
5
4
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@naman_deep_singh/errors-utils",
3
- "version": "1.3.2",
3
+ "version": "1.3.4",
4
4
  "description": "Standardized error classes and Express middleware for consistent error handling with TypeScript",
5
5
  "type": "module",
6
6
  "main": "./dist/cjs/index.js",
@@ -26,11 +26,11 @@
26
26
  "@types/express": "^5.0.5",
27
27
  "@types/node": "^25.0.1",
28
28
  "express": "^5.1.0",
29
- "typescript": "^5.9.3",
30
- "rimraf": "^5.0.5"
29
+ "rimraf": "^5.0.5",
30
+ "typescript": "^5.9.3"
31
31
  },
32
32
  "dependencies": {
33
- "@naman_deep_singh/response-utils": "^2.0.4"
33
+ "@naman_deep_singh/response-utils": "^2.1.4"
34
34
  },
35
35
  "scripts": {
36
36
  "build": "pnpm run build:types && tsc -p tsconfig.cjs.json && tsc -p tsconfig.esm.json",