@puq/error 0.0.2
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 +32 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/access-denied.d.ts +5 -0
- package/dist/lib/access-denied.d.ts.map +1 -0
- package/dist/lib/access-denied.js +9 -0
- package/dist/lib/access-denied.js.map +1 -0
- package/dist/lib/error-codes.d.ts +8 -0
- package/dist/lib/error-codes.d.ts.map +1 -0
- package/dist/lib/error-codes.js +12 -0
- package/dist/lib/error-codes.js.map +1 -0
- package/dist/lib/invalid-value.d.ts +5 -0
- package/dist/lib/invalid-value.d.ts.map +1 -0
- package/dist/lib/invalid-value.js +9 -0
- package/dist/lib/invalid-value.js.map +1 -0
- package/dist/lib/puq-error.d.ts +8 -0
- package/dist/lib/puq-error.d.ts.map +1 -0
- package/dist/lib/puq-error.js +15 -0
- package/dist/lib/puq-error.js.map +1 -0
- package/dist/lib/required-value.d.ts +5 -0
- package/dist/lib/required-value.d.ts.map +1 -0
- package/dist/lib/required-value.js +9 -0
- package/dist/lib/required-value.js.map +1 -0
- package/package.json +83 -0
package/README.md
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
<p align="center">
|
2
|
+
<img src="https://raw.githubusercontent.com/rbrightline/puq/refs/heads/main/libs/error/favicon.png" alt="Logo" />
|
3
|
+
</p>
|
4
|
+
|
5
|
+
# @puq/error
|
6
|
+
|
7
|
+
## Summary
|
8
|
+
|
9
|
+
Errors used accross the **puq** project
|
10
|
+
|
11
|
+
## Install
|
12
|
+
|
13
|
+
```bash
|
14
|
+
pnpm add @puq/error
|
15
|
+
```
|
16
|
+
|
17
|
+
## Funding
|
18
|
+
|
19
|
+
Thank you for using `@puq/error` It's an open-source project, and maintaining it takes time and effort. If you find this library useful, please consider supporting its ongoing development. Your contributions help ensure that the project stays up-to-date, secure, and well-maintained.
|
20
|
+
|
21
|
+
[Instant Funding](https://cash.app/$puqlib)
|
22
|
+
|
23
|
+
### Your funding will go toward
|
24
|
+
|
25
|
+
- **Bug fixes and updates** to ensure compatibility with the latest versions of dependencies.
|
26
|
+
- **New features** that will make the library even more powerful.
|
27
|
+
- **Documentation** improvements to help users get the most out of [Your Library Name].
|
28
|
+
- **General maintenance** to keep the library running smoothly and securely.
|
29
|
+
|
30
|
+
Contact to the developer: [robert.brightline@gmail.com]
|
31
|
+
|
32
|
+
[Support the developer](https://cash.app/$puqlib)
|
package/dist/index.d.ts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,wBAAwB,CAAC;AACvC,cAAc,sBAAsB,CAAC;AACrC,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC"}
|
package/dist/index.js
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
// @index(['./**/*.ts', '!./**/*.{spec,test}.ts'], f => `export * from '${f.path}.js'`)
|
2
|
+
export * from './lib/access-denied.js';
|
3
|
+
export * from './lib/error-codes.js';
|
4
|
+
export * from './lib/invalid-value.js';
|
5
|
+
export * from './lib/puq-error.js';
|
6
|
+
export * from './lib/required-value.js';
|
7
|
+
|
8
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["// @index(['./**/*.ts', '!./**/*.{spec,test}.ts'], f => `export * from '${f.path}.js'`)\nexport * from './lib/access-denied.js';\nexport * from './lib/error-codes.js';\nexport * from './lib/invalid-value.js';\nexport * from './lib/puq-error.js';\nexport * from './lib/required-value.js';\n"],"names":[],"rangeMappings":";;;;;","mappings":"AAAA,uFAAuF;AACvF,cAAc,yBAAyB;AACvC,cAAc,uBAAuB;AACrC,cAAc,yBAAyB;AACvC,cAAc,qBAAqB;AACnC,cAAc,0BAA0B"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"access-denied.d.ts","sourceRoot":"","sources":["../../src/lib/access-denied.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAEzD,qBAAa,iBAAkB,SAAQ,QAAQ;gBACjC,OAAO,SAAkB,EAAE,QAAQ,CAAC,EAAE,aAAa;CAGhE"}
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import { ErrorCode } from './error-codes.js';
|
2
|
+
import { PuqError } from './puq-error.js';
|
3
|
+
export class AccessDeniedError extends PuqError {
|
4
|
+
constructor(message = 'ACCESS_DENIED', metadata){
|
5
|
+
super(ErrorCode.ACCESS_DENIED, message, metadata);
|
6
|
+
}
|
7
|
+
}
|
8
|
+
|
9
|
+
//# sourceMappingURL=access-denied.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../../src/lib/access-denied.ts"],"sourcesContent":["import { ErrorCode } from './error-codes.js';\r\nimport { ErrorMetadata, PuqError } from './puq-error.js';\r\n\r\nexport class AccessDeniedError extends PuqError {\r\n constructor(message = 'ACCESS_DENIED', metadata?: ErrorMetadata) {\r\n super(ErrorCode.ACCESS_DENIED, message, metadata);\r\n }\r\n}\r\n"],"names":["ErrorCode","PuqError","AccessDeniedError","constructor","message","metadata","ACCESS_DENIED"],"rangeMappings":";;;;;;","mappings":"AAAA,SAASA,SAAS,QAAQ,mBAAmB;AAC7C,SAAwBC,QAAQ,QAAQ,iBAAiB;AAEzD,OAAO,MAAMC,0BAA0BD;IACrCE,YAAYC,UAAU,eAAe,EAAEC,QAAwB,CAAE;QAC/D,KAAK,CAACL,UAAUM,aAAa,EAAEF,SAASC;IAC1C;AACF"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"error-codes.d.ts","sourceRoot":"","sources":["../../src/lib/error-codes.ts"],"names":[],"mappings":"AAAA,oBAAY,SAAS;IAEnB,cAAc,OAAO;IACrB,aAAa,OAAA;IAGb,aAAa,OAAO;CACrB;AAED,oBAAY,mBAAmB;CAAG"}
|
@@ -0,0 +1,12 @@
|
|
1
|
+
export var ErrorCode;
|
2
|
+
(function(ErrorCode) {
|
3
|
+
// Validation Errors
|
4
|
+
ErrorCode[ErrorCode["REQURIED_VALUE"] = 6000] = "REQURIED_VALUE";
|
5
|
+
ErrorCode[ErrorCode["INVALID_VALUE"] = 6001] = "INVALID_VALUE";
|
6
|
+
// Security Error
|
7
|
+
ErrorCode[ErrorCode["ACCESS_DENIED"] = 9000] = "ACCESS_DENIED";
|
8
|
+
})(ErrorCode || (ErrorCode = {}));
|
9
|
+
export var FileSystemErrorCode;
|
10
|
+
(function(FileSystemErrorCode) {})(FileSystemErrorCode || (FileSystemErrorCode = {}));
|
11
|
+
|
12
|
+
//# sourceMappingURL=error-codes.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../../src/lib/error-codes.ts"],"sourcesContent":["export enum ErrorCode {\r\n // Validation Errors\r\n REQURIED_VALUE = 6000,\r\n INVALID_VALUE,\r\n\r\n // Security Error\r\n ACCESS_DENIED = 9000,\r\n}\r\n\r\nexport enum FileSystemErrorCode {}\r\n"],"names":["ErrorCode","FileSystemErrorCode"],"rangeMappings":";;;;;;;;;","mappings":";UAAYA;IACV,oBAAoB;;;IAIpB,iBAAiB;;GALPA,cAAAA;;UASAC,yBAAAA,wBAAAA"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"invalid-value.d.ts","sourceRoot":"","sources":["../../src/lib/invalid-value.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAEzD,qBAAa,iBAAkB,SAAQ,QAAQ;gBACjC,OAAO,SAAkB,EAAE,QAAQ,CAAC,EAAE,aAAa;CAGhE"}
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import { ErrorCode } from './error-codes.js';
|
2
|
+
import { PuqError } from './puq-error.js';
|
3
|
+
export class InvalidValueError extends PuqError {
|
4
|
+
constructor(message = 'INVALID_VALUE', metadata){
|
5
|
+
super(ErrorCode.INVALID_VALUE, message, metadata);
|
6
|
+
}
|
7
|
+
}
|
8
|
+
|
9
|
+
//# sourceMappingURL=invalid-value.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../../src/lib/invalid-value.ts"],"sourcesContent":["import { ErrorCode } from './error-codes.js';\r\nimport { ErrorMetadata, PuqError } from './puq-error.js';\r\n\r\nexport class InvalidValueError extends PuqError {\r\n constructor(message = 'INVALID_VALUE', metadata?: ErrorMetadata) {\r\n super(ErrorCode.INVALID_VALUE, message, metadata);\r\n }\r\n}\r\n"],"names":["ErrorCode","PuqError","InvalidValueError","constructor","message","metadata","INVALID_VALUE"],"rangeMappings":";;;;;;","mappings":"AAAA,SAASA,SAAS,QAAQ,mBAAmB;AAC7C,SAAwBC,QAAQ,QAAQ,iBAAiB;AAEzD,OAAO,MAAMC,0BAA0BD;IACrCE,YAAYC,UAAU,eAAe,EAAEC,QAAwB,CAAE;QAC/D,KAAK,CAACL,UAAUM,aAAa,EAAEF,SAASC;IAC1C;AACF"}
|
@@ -0,0 +1,8 @@
|
|
1
|
+
import { ErrorCode } from './error-codes.js';
|
2
|
+
export type ErrorMetadata = Record<string, unknown>;
|
3
|
+
export declare class PuqError extends Error {
|
4
|
+
readonly code: ErrorCode;
|
5
|
+
readonly metadata?: ErrorMetadata;
|
6
|
+
constructor(code: ErrorCode, message: string, metadata?: ErrorMetadata);
|
7
|
+
}
|
8
|
+
//# sourceMappingURL=puq-error.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"puq-error.d.ts","sourceRoot":"","sources":["../../src/lib/puq-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE7C,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAEpD,qBAAa,QAAS,SAAQ,KAAK;IACjC,SAAgB,IAAI,EAAE,SAAS,CAAC;IAChC,SAAgB,QAAQ,CAAC,EAAE,aAAa,CAAC;gBAE7B,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,aAAa;CAavE"}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
export class PuqError extends Error {
|
2
|
+
constructor(code, message, metadata){
|
3
|
+
super(message);
|
4
|
+
this.code = code;
|
5
|
+
this.metadata = metadata;
|
6
|
+
// Fix prototype chain for proper instanceof checks
|
7
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
8
|
+
// Capture the stack trace (Node.js and Chrome V8 engines)
|
9
|
+
if (Error.captureStackTrace) {
|
10
|
+
Error.captureStackTrace(this, this.constructor);
|
11
|
+
}
|
12
|
+
}
|
13
|
+
}
|
14
|
+
|
15
|
+
//# sourceMappingURL=puq-error.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../../src/lib/puq-error.ts"],"sourcesContent":["import { ErrorCode } from './error-codes.js';\r\n\r\nexport type ErrorMetadata = Record<string, unknown>;\r\n\r\nexport class PuqError extends Error {\r\n public readonly code: ErrorCode;\r\n public readonly metadata?: ErrorMetadata;\r\n\r\n constructor(code: ErrorCode, message: string, metadata?: ErrorMetadata) {\r\n super(message);\r\n this.code = code;\r\n this.metadata = metadata;\r\n\r\n // Fix prototype chain for proper instanceof checks\r\n Object.setPrototypeOf(this, new.target.prototype);\r\n\r\n // Capture the stack trace (Node.js and Chrome V8 engines)\r\n if (Error.captureStackTrace) {\r\n Error.captureStackTrace(this, this.constructor);\r\n }\r\n }\r\n}\r\n"],"names":["PuqError","Error","constructor","code","message","metadata","Object","setPrototypeOf","prototype","captureStackTrace"],"rangeMappings":";;;;;;;;;;;;","mappings":"AAIA,OAAO,MAAMA,iBAAiBC;IAI5BC,YAAYC,IAAe,EAAEC,OAAe,EAAEC,QAAwB,CAAE;QACtE,KAAK,CAACD;QACN,IAAI,CAACD,IAAI,GAAGA;QACZ,IAAI,CAACE,QAAQ,GAAGA;QAEhB,mDAAmD;QACnDC,OAAOC,cAAc,CAAC,IAAI,EAAE,WAAWC,SAAS;QAEhD,0DAA0D;QAC1D,IAAIP,MAAMQ,iBAAiB,EAAE;YAC3BR,MAAMQ,iBAAiB,CAAC,IAAI,EAAE,IAAI,CAACP,WAAW;QAChD;IACF;AACF"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"required-value.d.ts","sourceRoot":"","sources":["../../src/lib/required-value.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAEzD,qBAAa,kBAAmB,SAAQ,QAAQ;gBAClC,OAAO,SAAmB,EAAE,QAAQ,CAAC,EAAE,aAAa;CAGjE"}
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import { ErrorCode } from './error-codes.js';
|
2
|
+
import { PuqError } from './puq-error.js';
|
3
|
+
export class RequiredValueError extends PuqError {
|
4
|
+
constructor(message = 'REQURIED_VALUE', metadata){
|
5
|
+
super(ErrorCode.REQURIED_VALUE, message, metadata);
|
6
|
+
}
|
7
|
+
}
|
8
|
+
|
9
|
+
//# sourceMappingURL=required-value.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../../src/lib/required-value.ts"],"sourcesContent":["import { ErrorCode } from './error-codes.js';\r\nimport { ErrorMetadata, PuqError } from './puq-error.js';\r\n\r\nexport class RequiredValueError extends PuqError {\r\n constructor(message = 'REQURIED_VALUE', metadata?: ErrorMetadata) {\r\n super(ErrorCode.REQURIED_VALUE, message, metadata);\r\n }\r\n}\r\n"],"names":["ErrorCode","PuqError","RequiredValueError","constructor","message","metadata","REQURIED_VALUE"],"rangeMappings":";;;;;;","mappings":"AAAA,SAASA,SAAS,QAAQ,mBAAmB;AAC7C,SAAwBC,QAAQ,QAAQ,iBAAiB;AAEzD,OAAO,MAAMC,2BAA2BD;IACtCE,YAAYC,UAAU,gBAAgB,EAAEC,QAAwB,CAAE;QAChE,KAAK,CAACL,UAAUM,cAAc,EAAEF,SAASC;IAC3C;AACF"}
|
package/package.json
ADDED
@@ -0,0 +1,83 @@
|
|
1
|
+
{
|
2
|
+
"name": "@puq/error",
|
3
|
+
"license": "MIT",
|
4
|
+
"version": "0.0.2",
|
5
|
+
"publishConfig": {
|
6
|
+
"access": "public",
|
7
|
+
"tag": "latest"
|
8
|
+
},
|
9
|
+
"description": "Errors used accross the **puq** project",
|
10
|
+
"author": {
|
11
|
+
"email": "robert.brightline@gmail.com",
|
12
|
+
"name": "Robert Brightline",
|
13
|
+
"url": "https://rbrightline.github.io"
|
14
|
+
},
|
15
|
+
"keywords": [
|
16
|
+
"puq",
|
17
|
+
"error"
|
18
|
+
],
|
19
|
+
"repository": {
|
20
|
+
"directory": "libs/error",
|
21
|
+
"url": "https://github.com/rbrightline/puq/tree/main",
|
22
|
+
"type": "github"
|
23
|
+
},
|
24
|
+
"homepage": "https://rbrightline.github.io/puq/error",
|
25
|
+
"bugs": {
|
26
|
+
"email": "robert.brightline@gmail.com",
|
27
|
+
"url": "https://rbrightline.github.io"
|
28
|
+
},
|
29
|
+
"categories": [
|
30
|
+
"Other"
|
31
|
+
],
|
32
|
+
"contributors": [
|
33
|
+
{
|
34
|
+
"email": "robert.brightline@gmail.com",
|
35
|
+
"name": "Robert Brightline",
|
36
|
+
"url": "https://rbrightline.github.io"
|
37
|
+
}
|
38
|
+
],
|
39
|
+
"funding": [
|
40
|
+
"https://cash.app/$puqlib"
|
41
|
+
],
|
42
|
+
"icon": "https://raw.githubusercontent.com/rbrightline/puq/refs/heads/main/libs/error/favicon.png",
|
43
|
+
"type": "module",
|
44
|
+
"main": "./dist/index.js",
|
45
|
+
"module": "./dist/index.js",
|
46
|
+
"types": "./dist/index.d.ts",
|
47
|
+
"exports": {
|
48
|
+
"./package.json": "./package.json",
|
49
|
+
".": {
|
50
|
+
"types": "./dist/index.d.ts",
|
51
|
+
"import": "./dist/index.js",
|
52
|
+
"default": "./dist/index.js"
|
53
|
+
}
|
54
|
+
},
|
55
|
+
"files": [
|
56
|
+
"dist",
|
57
|
+
"!**/*.tsbuildinfo"
|
58
|
+
],
|
59
|
+
"nx": {
|
60
|
+
"sourceRoot": "libs/error/src",
|
61
|
+
"targets": {
|
62
|
+
"build": {
|
63
|
+
"executor": "@nx/js:swc",
|
64
|
+
"outputs": [
|
65
|
+
"{options.outputPath}"
|
66
|
+
],
|
67
|
+
"options": {
|
68
|
+
"outputPath": "libs/error/dist",
|
69
|
+
"main": "libs/error/src/index.ts",
|
70
|
+
"tsConfig": "libs/error/tsconfig.lib.json",
|
71
|
+
"skipTypeCheck": false,
|
72
|
+
"stripLeadingPaths": true
|
73
|
+
}
|
74
|
+
},
|
75
|
+
"doc": {
|
76
|
+
"command": "cd libs/error && npx compodoc -d ../../public/error -p tsconfig.lib.json -n error"
|
77
|
+
}
|
78
|
+
}
|
79
|
+
},
|
80
|
+
"devDependencies": {
|
81
|
+
"@swc/helpers": "~0.5.11"
|
82
|
+
}
|
83
|
+
}
|