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: include more context in errors #31

Merged
merged 4 commits into from
Jan 9, 2024
Merged

feat: include more context in errors #31

merged 4 commits into from
Jan 9, 2024

Conversation

ajatprabha
Copy link
Contributor

Current errors do not provide much info into where to look for malformed values. This change aims to provide more context around errors.

@codecov-commenter
Copy link

codecov-commenter commented Jan 8, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (0020145) 98.97% compared to head (919eca4) 98.85%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #31      +/-   ##
==========================================
- Coverage   98.97%   98.85%   -0.12%     
==========================================
  Files          35       36       +1     
  Lines         781      789       +8     
==========================================
+ Hits          773      780       +7     
- Misses          8        9       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ajatprabha ajatprabha requested a review from sonnes January 8, 2024 09:52
@sonnes
Copy link
Collaborator

sonnes commented Jan 9, 2024

Is it possible to support errors.Is? Something like

if errors.Is(err, xload.ErrRequired):
   ...

@ajatprabha
Copy link
Contributor Author

ajatprabha commented Jan 9, 2024

Is it possible to support errors.Is? Something like

if errors.Is(err, xload.ErrRequired):
   ...

errors.Is would not work as it cannot work with struct types but only initialized variables, errors.As will work instead, syntax would look like:

var reqErr xload.ErrRequired
if errors.As(err, &reqErr) {
	...
}

@ajatprabha ajatprabha merged commit 6f7f235 into main Jan 9, 2024
4 checks passed
@ajatprabha ajatprabha deleted the updates-errors branch January 9, 2024 06:41
@ajatprabha ajatprabha mentioned this pull request Jan 11, 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