errors.mjs
sha256:65ccb454656ea5acdea0a10e559b78bcde1eb6ff753ecc2911bc99d1c3d7cadd
feat(calendar): enforce agent context tiers in retrieval AP…
Human
minor
⚠ breaking
1 day ago
| 1 | /** |
| 2 | * CLI error handling: exit 1 (usage) / 2 (runtime), optional JSON error object. SPEC §4.2, §4.3. |
| 3 | */ |
| 4 | |
| 5 | /** |
| 6 | * Print error and exit. With useJson, writes { "error": message, "code": code } to stderr and exits. |
| 7 | * @param {string} message |
| 8 | * @param {1|2} code - 1 = usage, 2 = runtime |
| 9 | * @param {boolean} useJson - If true, output JSON error object to stderr |
| 10 | */ |
| 11 | export function exitWithError(message, code = 1, useJson = false) { |
| 12 | if (useJson) { |
| 13 | const err = { error: message, code: code === 1 ? 'USAGE_ERROR' : 'RUNTIME_ERROR' }; |
| 14 | process.stderr.write(JSON.stringify(err) + '\n'); |
| 15 | } else { |
| 16 | console.error(message); |
| 17 | } |
| 18 | process.exit(code); |
| 19 | } |
File History
2 commits
sha256:65ccb454656ea5acdea0a10e559b78bcde1eb6ff753ecc2911bc99d1c3d7cadd
feat(calendar): enforce agent context tiers in retrieval AP…
Human
minor
⚠
1 day ago
sha256:9103f98c89257ed2b01c237cea895dabb3e85ea337dccb1161c175e4422355b6
docs: accept Calendar Events v0 spec with Phase 0 security …
Human
1 day ago