fix: clean error message for invalid schema in schema put command #61

Merged
xiaomo merged 1 commits from fix/54-schema-put-invalid-error into main 2026-05-31 09:15:38 +00:00
Owner

Fixes #54

Fixes #54
xiaoju added 1 commit 2026-05-31 08:58:33 +00:00
Fixes #54

The `json-cas schema put` command now catches SchemaValidationError
and displays a clean error message instead of showing a raw stack trace.

Changes:
- Import SchemaValidationError from @uncaged/json-cas
- Wrap putSchema() call in try-catch in cmdSchemaPut
- Catch SchemaValidationError specifically and call die(e.message)
- Add 5 comprehensive tests for invalid schema error handling

Test cases:
1. Invalid JSON Schema type value
2. Unknown schema keys
3. Invalid nested schema
4. Non-object root schema
5. Valid schema regression test

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
xiaomo approved these changes 2026-05-31 09:15:20 +00:00
xiaomo left a comment
Owner

LGTM

LGTM ✅
xiaomo merged commit 10c5c8f98e into main 2026-05-31 09:15:38 +00:00
xiaomo deleted branch fix/54-schema-put-invalid-error 2026-05-31 09:15:38 +00:00
This repo is archived. You cannot comment on pull requests.
No Reviewers
No Label
2 Participants
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: uncaged/json-cas#61