goccy / go-yaml

YAML support for the Go language
MIT License
1.12k stars 129 forks source link

feat: expose syntax and type errors #424

Open nieomylnieja opened 7 months ago

nieomylnieja commented 7 months ago

Before submitting your PR, please confirm the following.

codecov-commenter commented 7 months ago

:warning: 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).

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

Additional details and impacted files ```diff @@ 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 commented 7 months ago

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.

andig commented 3 months ago

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 commented 2 months ago

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