Skip to content

Conversation

char0n
Copy link
Member

@char0n char0n commented Mar 15, 2025

Closes #5

@char0n char0n requested a review from Copilot March 15, 2025 14:12
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds support for attaching contextual data to error objects and standardizes error types throughout JSON Pointer handling. It updates error constructors and error throwing in both evaluation and compilation paths while also adding type-checks for inputs.

  • Updated error constructors signatures in JSONPointer*Error classes to accept a message and options.
  • Revised tests to expect native TypeError for invalid input types.
  • Enhanced error context data passed to errors in evaluate and parse functions.

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/errors/JSONPointerKeyError.js Updated constructor signature and conditional error message creation.
src/errors/JSONPointerTypeError.js Updated constructor signature and conditional error message creation.
test/parse.js Adjusted tests to expect TypeError for non-string inputs.
src/unescape.js Added type-checking for input referenceToken.
test/compile.js Adjusted tests to expect TypeError for invalid input.
src/compile.js Added array check for referenceTokens and updated error message.
src/evaluate.js Enhanced error context data in evaluate with extra properties.
src/parse/index.js Standardized error types in parse for invalid input and unexpected errors.

@char0n char0n mentioned this pull request Mar 15, 2025
@char0n char0n self-assigned this Mar 15, 2025
@char0n char0n merged commit 9186c38 into main Mar 15, 2025
4 checks passed
@char0n char0n deleted the char0n/5 branch March 15, 2025 14:22
char0n pushed a commit that referenced this pull request Mar 15, 2025
# [1.2.0](v1.1.0...v1.2.0) (2025-03-15)

### Features

* **errors:** add support for attaching data to errors ([#12](#12)) ([9186c38](9186c38)), closes [#5](#5)
@char0n
Copy link
Member Author

char0n commented Mar 15, 2025

🎉 This PR is included in version 1.2.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Attach data to errors

1 participant