{"_id":"@qvac/error","_rev":"10-018d31fecec7149e7b0f2e90449985da","name":"@qvac/error","dist-tags":{"latest":"0.2.0"},"versions":{"0.1.0":{"name":"@qvac/error","version":"0.1.0","keywords":["tether","error","qvac"],"author":{"name":"Tether"},"license":"Apache-2.0","_id":"@qvac/error@0.1.0","maintainers":[{"name":"donriddo","email":"donriddo@gmail.com"},{"name":"namelessking","email":"dmytro.medvinskyi@tether.to"},{"name":"marco-tether","email":"marco.chiappetta@tether.io"},{"name":"deepakjangid","email":"deepak.jangid@tether.io"},{"name":"gustavoa1604","email":"gustavo.araujo@tether.io"},{"name":"brunocampana","email":"bruno.ramos@tether.io"},{"name":"moromisato","email":"luis.moromisato@tether.to"},{"name":"jamiebohanna","email":"jamie.bohanna@tether.io"},{"name":"ignaciolarranaga","email":"ignaciolarranaga@gmail.com"},{"name":"raju.sharma","email":"raju.sharma@tether.io"},{"name":"gianni-tether","email":"gianfranco.cordella@tether.io"},{"name":"yaswanthkoneri-tether","email":"yaswanth.koneri@tether.io"},{"name":"naveen.reddy","email":"naveen.reddy@tether.io"},{"name":"ishan.vohra","email":"ishan.vohra@tether.io"},{"name":"mekhakt","email":"mekhak.shoyan@tether.io"},{"name":"opanin-tether","email":"opanin.akuffo@tether.io"},{"name":"khvgiorgi","email":"g.khvedelidze@noxtton.com"},{"name":"dpopkhadze","email":"d.popkhadze@noxtton.com"},{"name":"nodar-mosia","email":"n.mosia@noxtton.com"},{"name":"elf-slacking","email":"n.razmadze@noxtton.com"},{"name":"sheptang","email":"yarkinyucel@gmail.com"},{"name":"harri-saar-noxtton","email":"h.saar@noxtton.com"},{"name":"hakaari","email":"g.javakhidze@noxtton.com"},{"name":"kartik-tether","email":"kartik.sain@tether.io"},{"name":"supersuryaansh","email":"suryaansh738@gmail.com"},{"name":"mikker","email":"mikkel@brnbw.com"},{"name":"subash.77","email":"subash@tether.io"},{"name":"xtmntxraphaelx","email":"rahul_garg08@yahoo.com"},{"name":"dimitristzimikas","email":"tzimikasd@gmail.com"},{"name":"gusttav-lang","email":"gusttavlang@gmail.com"},{"name":"maidh91","email":"maidh91@gmail.com"},{"name":"xmastree","email":"ozanhonamlioglu@gmail.com"},{"name":"ahsanakhtar91","email":"ahsanakhtar91@yahoo.com"},{"name":"cayasso","email":"cayasso@gmail.com"},{"name":"educastellano","email":"educastellano08@gmail.com"},{"name":"yuranich","email":"yuri.samarin@tether.to"},{"name":"bubuts","email":"ramaz.tskhadadze28@gmail.com"},{"name":"d_cassidy","email":"dominic@cassidy.casa"},{"name":"mialsot","email":"mialsot@gmail.com"},{"name":"tonygo","email":"gorez.tony@gmail.com"},{"name":"eckoit","email":"ryan.ramage@gmail.com"},{"name":"harshit.s.rawat","email":"harshit.rawat@tether.io"}],"bugs":{"url":"https://github.com/tetherto/qvac-lib-error-base/issues"},"dist":{"shasum":"ee70f252df0a87e6d407d824af86e13629bb9249","tarball":"https://registry.npmjs.org/@qvac/error/-/error-0.1.0.tgz","fileCount":5,"integrity":"sha512-KA3jX+Wb1/vqSzd/1zZLXWMLBJutW4gtzvsxXCr5aU/7NyYafTWIXOKMZ7uUd7RYdiqMh6ZBj8zQ3ElCTV/5PQ==","signatures":[{"sig":"MEUCIDf5d4LvYckjpilGRTxbkgn9XbYtWxHBVPc+m3UNuX5XAiEAmXpTpys0xEwI6vu4rMOIyEtoOoOGkRG89du4Tn3eaDE=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":24082},"main":"index.js","types":"index.d.ts","gitHead":"01aa53d1815e6530f2348e5e7acf5d3e98985a80","scripts":{"lint":"standard","test":"npm run test:unit && npm run test:dts","lint:fix":"standard --fix","test:dts":"tsc index.d.ts --noEmit","test:unit":"npm run test:unit:generate && bare test/unit/all.js","test:coverage":"brittle --coverage test/**/*.test.js","test:unit:generate":"brittle -r test/unit/all.js test/unit/*.test.js"},"_npmUser":{"name":"subash.77","email":"subash@tether.io"},"_npmVersion":"10.8.2","description":"Base error handling library for QVAC","directories":{},"_nodeVersion":"18.20.8","_hasShrinkwrap":false,"devDependencies":{"brittle":"^3.10.1","standard":"17.1.0"},"_npmOperationalInternal":{"tmp":"tmp/error_0.1.0_1760101323774_0.3436823540744953","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@qvac/error","version":"0.1.1","keywords":["tether","error","qvac"],"author":{"name":"Tether"},"license":"Apache-2.0","_id":"@qvac/error@0.1.1","maintainers":[{"name":"prdn","email":"paolo.ardoino@gmail.com"},{"name":"subash.77","email":"subash@tether.io"}],"bugs":{"url":"https://github.com/tetherto/qvac-lib-error-base/issues"},"dist":{"shasum":"9472db16524d3b2b340452b0b4d9db06728eb1b6","tarball":"https://registry.npmjs.org/@qvac/error/-/error-0.1.1.tgz","fileCount":5,"integrity":"sha512-Xv7p1wnC/JmsKimGrkvXlcq+AHsG1r33f+uayANuEYe5ThFi+FR3txnN2UPjulwBdDorEnger9/+9ftShAFOAw==","signatures":[{"sig":"MEYCIQD4lT8G5JHjrc1lxy27gJoZdPyCjVV56xwL2P4VDc6JqgIhAJ0cSHJC+kh25zzH3+P8hJIYRY99v0PBDgn455smFkId","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":27739},"main":"index.js","types":"index.d.ts","gitHead":"28d545db6452da271fb111b0c4da6950c0473039","scripts":{"lint":"standard","test":"npm run test:unit && npm run test:dts","prepare":"husky || true","lint:fix":"standard --fix","test:dts":"tsc index.d.ts --noEmit","test:unit":"npm run test:unit:generate && bare test/unit/all.js","build:types":"tsc","test:coverage":"brittle --coverage test/**/*.test.js","test:unit:generate":"brittle -r test/unit/all.js test/unit/*.test.js"},"_npmUser":{"name":"subash.77","email":"subash@tether.io"},"_npmVersion":"10.8.2","description":"Base error handling library for QVAC","directories":{},"_nodeVersion":"18.20.8","_hasShrinkwrap":false,"devDependencies":{"husky":"^9.1.7","brittle":"^3.10.1","standard":"17.1.0","typescript":"^5.9.3"},"_npmOperationalInternal":{"tmp":"tmp/error_0.1.1_1768468113595_0.8430152010765954","host":"s3://npm-registry-packages-npm-production"}},"0.2.0":{"name":"@qvac/error","version":"0.2.0","description":"Base error handling library for QVAC","type":"module","main":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"},"./package.json":"./package.json"},"scripts":{"format":"prettier --check .","format:fix":"prettier --write .","lint":"lunte","lint:fix":"lunte --fix","typecheck":"tsc --noEmit -p tsconfig.json && tsc --noEmit -p test/tsconfig.json","build":"tsc -p tsconfig.build.json","prepare":"npm run build","build:test":"tsc -p test/tsconfig.build.json","test:unit":"npm run build:test && brittle-bare 'test/dist/test/unit/*.test.js'"},"author":{"name":"Tether"},"keywords":["tether","error","qvac"],"license":"Apache-2.0","devDependencies":{"@types/brittle":"^3.5.0","brittle":"^3.10.1","lunte":"^1.8.3","prettier":"^3.9.4","prettier-config-holepunch":"^2.0.0","typescript":"^5.9.3"},"repository":{"type":"git","url":"git+https://github.com/tetherto/qvac.git","directory":"packages/error"},"bugs":{"url":"https://github.com/tetherto/qvac/issues"},"homepage":"https://qvac.tether.io","gitHead":"01cdd6931a0f0084dce028d417f1fb5326336a29","_id":"@qvac/error@0.2.0","_nodeVersion":"24.14.1","_npmVersion":"11.11.0","dist":{"integrity":"sha512-HZSJBeqppA23HXoxs70Wj6+rm9KAEX9UmYPjMch/Mte0y32j32pmp0ovm09x1vu8Lknk7DwUDENhqFVEySKh+g==","shasum":"4baebd028131260d0cc08c4ce3f4f57f19e0326e","tarball":"https://registry.npmjs.org/@qvac/error/-/error-0.2.0.tgz","fileCount":6,"unpackedSize":23883,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@qvac%2ferror@0.2.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQD7aJE2SGY9h1W+g+lB+fd1+C5jHBlDHNHgGlXFv7n7oQIgR4L3zbdLUNCUuK2F28HwyS3oLpa6flDzgAk9PBo7eJw="}]},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:8c85f9ed-708f-494b-9c83-ac3101c0ba71"}},"directories":{},"maintainers":[{"name":"mafintosh","email":"mathiasbuus@gmail.com"},{"name":"prdn","email":"paolo.ardoino@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/error_0.2.0_1789373230547_0.6691240464580601"},"_hasShrinkwrap":false}},"time":{"created":"2025-10-10T13:02:03.651Z","modified":"2026-09-14T08:07:11.082Z","0.1.0":"2025-10-10T13:02:03.945Z","0.1.1":"2026-01-15T09:08:33.738Z","0.2.0":"2026-09-14T08:07:10.680Z"},"bugs":{"url":"https://github.com/tetherto/qvac/issues"},"author":{"name":"Tether"},"license":"Apache-2.0","keywords":["tether","error","qvac"],"description":"Base error handling library for QVAC","maintainers":[{"name":"mafintosh","email":"mathiasbuus@gmail.com"},{"name":"prdn","email":"paolo.ardoino@gmail.com"}],"readme":"# @qvac/error\n\nThis library provides standardized error handling capabilities for all QVAC libraries. It ensures consistency in error reporting, serialization, and handling across the entire QVAC ecosystem.\n\n## Installation\n\n```bash\nnpm i @qvac/error\n```\n\n## Features\n\n- Base error class extending native Error\n- Standardized error codes and messages\n- Support for dynamic error messages with parameters\n- Error serialization for logging and API responses\n- Registry system for error code management\n- Mechanisms to prevent error code conflicts\n\n## Usage\n\n### Basic Usage\n\n```javascript\nimport { QvacErrorBase, addCodes } from '@qvac/error'\n\n// Create your own error class extending the base\nclass QvacErrorCustom extends QvacErrorBase {}\n\n// Define your error codes (reserve at least 1000 codes per library)\nconst ERR_CODES = Object.freeze({\n  VALIDATION_ERROR: 1000,\n  CONNECTION_ERROR: 1001,\n  TIMEOUT_ERROR: 1002\n})\n\n// Register your error codes and their messages\naddCodes({\n  [ERR_CODES.VALIDATION_ERROR]: {\n    name: 'VALIDATION_ERROR',\n    message: (...field) => `Validation failed for field: ${field}`\n  },\n  [ERR_CODES.CONNECTION_ERROR]: {\n    name: 'CONNECTION_ERROR',\n    message: 'Failed to establish connection'\n  },\n  [ERR_CODES.TIMEOUT_ERROR]: {\n    name: 'TIMEOUT_ERROR',\n    message: (timeout) => `Operation timed out after ${timeout}ms`\n  }\n})\n\n// Using your custom errors\ntry {\n  // Some operation that fails\n  throw new QvacErrorCustom({ code: ERR_CODES.VALIDATION_ERROR, adds: 'username' })\n} catch (error) {\n  console.error(error.message) // \"Validation failed for field: username\"\n  console.error(error.code) // 1000\n  console.error(error.name) // \"VALIDATION_ERROR\"\n}\n```\n\n### Error Code Conventions\n\n- Each library should reserve a range of at least 1000 codes\n- Keep codes in ascending order based on abstraction level\n- Base libraries should have lower code ranges\n- Document your code range to avoid conflicts with other libraries\n\n### API Reference\n\n#### `QvacErrorBase`\n\nBase error class that extends the native Error.\n\n```javascript\nnew QvacErrorBase(options)\n```\n\n- `options.code` (Number): The error code\n- `options.adds` (Array|String): Additional parameters to format the error message\n- `options.cause` (Error): The underlying error that caused this one\n\n#### `addCodes(codes)`\n\nRegister new error codes.\n\n- `codes` (Object): Map of error codes to their definitions\n\n#### `getRegisteredCodes()`\n\nGet all registered error codes and their definitions.\n\n#### `isCodeRegistered(code)`\n\nCheck if a code is already registered.\n\n- `code` (Number): The error code to check\n\n#### `INTERNAL_ERROR_CODES`\n\nReserved internal error codes:\n\n- `UNKNOWN_ERROR_CODE`: 0\n- `INVALID_CODE_DEFINITION`: 1\n- `ERROR_CODE_ALREADY_EXISTS`: 2\n- `MISSING_ERROR_DEFINITION`: 3\n- `PACKAGE_VERSION_CONFLICT`: 4\n- `INVALID_PACKAGE_INFO`: 5\n\n## Development\n\nThe package is written in TypeScript under `src/` and compiled to `dist/` with `tsc`.\nAfter cloning, run `npm install` (its `prepare` script builds `dist/`); run `npm run build`\nto recompile, `npm run typecheck` to type-check, and `npm run test:unit` for the tests.\n\n## Best Practices\n\n1. Create a dedicated errors file/module in each library\n2. Extend `QvacErrorBase` with a library-specific class name (e.g., `QvacErrorAgent`)\n3. Keep all error codes in a separate, well-documented module\n4. Use descriptive error names and clear messages\n5. Avoid relying on error messages for logic (use codes instead)\n6. Consider generating documentation from your error codes\n","readmeFilename":"README.md","homepage":"https://qvac.tether.io","repository":{"type":"git","url":"git+https://github.com/tetherto/qvac.git","directory":"packages/error"}}