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

Return Error from ParseLevel #83

Merged

Conversation

dezren39
Copy link
Contributor

@dezren39 dezren39 commented Oct 31, 2023

resolves #79

this adds an error result to the parse level function.

this change changes the return signature for ParseLevel!

users of ParseLevel will need to handle the error or choose to disregard it.

people will see the 'multiple values in a single context' error like below

log on  strict-parse-level [!?] via 🐹 v1.21.3 
  ❯ go test 
# github.com/charmbracelet/log [github.com/charmbracelet/log.test]
.\level_test.go:58:33: multiple-value ParseLevel(tc.level) (value of type (Level, error)) in single-value context
FAIL    github.com/charmbracelet/log [build failed]

@dezren39 dezren39 marked this pull request as ready for review October 31, 2023 06:25
@dezren39 dezren39 changed the title add parse level error Return Error from ParseLevel Oct 31, 2023
Copy link
Member

@aymanbagabas aymanbagabas left a comment

Choose a reason for hiding this comment

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

Thank you @dezren39 for this work, a few comments below

level.go Outdated Show resolved Hide resolved
level.go Outdated Show resolved Hide resolved
level_test.go Outdated Show resolved Hide resolved
level_test.go Outdated Show resolved Hide resolved
dezren39 and others added 3 commits October 31, 2023 20:44
will fix rest of file in follow-up commit

Co-authored-by: Ayman Bagabas <[email protected]>
@dezren39 dezren39 requested a review from aymanbagabas November 1, 2023 01:52
Copy link

codecov bot commented Nov 1, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (e5a733b) 77.63% compared to head (820a435) 80.25%.
Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #83      +/-   ##
==========================================
+ Coverage   77.63%   80.25%   +2.61%     
==========================================
  Files          10       10              
  Lines         635      699      +64     
==========================================
+ Hits          493      561      +68     
+ Misses        128      125       -3     
+ Partials       14       13       -1     
Files Coverage Δ
level.go 92.85% <100.00%> (ø)

... and 4 files with indirect coverage changes

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

level.go Outdated Show resolved Hide resolved
level.go Show resolved Hide resolved
@dezren39 dezren39 requested a review from aymanbagabas November 6, 2023 22:27
level.go Outdated Show resolved Hide resolved
@aymanbagabas aymanbagabas merged commit d96bea2 into charmbracelet:main Nov 7, 2023
9 checks passed
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.

Strict ParseLevel
2 participants