Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: expose syntax and type errors #424

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

nieomylnieja
Copy link
Contributor

@nieomylnieja nieomylnieja commented Feb 1, 2024

Before submitting your PR, please confirm the following.

  • Describe the purpose for which you created this PR.
    Solves Return structured errors #423
  • Create test code that corresponds to the modification
    Unit tested yaml.AsTokenScopedError, tests added to error_test.go

@codecov-commenter
Copy link

codecov-commenter commented Feb 1, 2024

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

Attention: Patch coverage is 90.47619% with 2 lines in your changes missing coverage. Please review.

Project coverage is 78.76%. Comparing base (b2a8cc6) to head (8e172f1).

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #424      +/-   ##
==========================================
+ Coverage   78.65%   78.76%   +0.10%     
==========================================
  Files          13       13              
  Lines        3983     4003      +20     
==========================================
+ Hits         3133     3153      +20     
- Misses        590      591       +1     
+ Partials      260      259       -1     

@nieomylnieja
Copy link
Contributor Author

Coming to think about, TypeError is equally useful as SyntaxError.
Maybe we could simply export the whole package? Would you consider that @goccy?
Then we wouldn't need to implement any As... extractor functions, anyone interested in reading these errors could simply do errors.As on their own.

@nieomylnieja nieomylnieja changed the title feat: expose syntax errors feat: expose syntax and type errors Feb 3, 2024
@andig
Copy link

andig commented Jun 10, 2024

This is the one feature I'd look for over gopkg.in/yaml.v3. It should include source information though, i.e. line and column number.

@nieomylnieja
Copy link
Contributor Author

@andig it does include these details, that's what the token.Token exposes

nieomylnieja added a commit to nobl9/go-yaml that referenced this pull request Jul 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants