-
Notifications
You must be signed in to change notification settings - Fork 0
*: Improve documentation #16
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
Conversation
|
|
||
| func (e MyError) Error() string { return e.message } | ||
|
|
||
| type MyErrorWithCode struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci] reported by reviewdog 🐶
the error type name MyErrorWithCode should conform to the XxxError format (errname)
| // Create an error and attach a domain for categorization | ||
| err := errors.New("operation failed") | ||
| errWithDomain := errors.WithDomain(err, "database") | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci] reported by reviewdog 🐶
File is not properly formatted (gofmt)
| func ExampleOpaque() { | ||
| // Create an internal error that we want to hide | ||
| internalErr := errors.New("database connection pool exhausted") | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci] reported by reviewdog 🐶
File is not properly formatted (gofmt)
| // Create an error and attach a status | ||
| err := errors.New("request processing failed") | ||
| errWithStatus := errors.WithStatus(err, "failed") | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci] reported by reviewdog 🐶
File is not properly formatted (gofmt)
|
|
||
| func ExampleWithTags() { | ||
| userID := "user123" | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci] reported by reviewdog 🐶
File is not properly formatted (gofmt)
| "github.com/upfluence/errors/base" | ||
| ) | ||
|
|
||
| // Statuser provides a custom status string for an error. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci] reported by reviewdog 🐶Statuser is a misspelling of Stature (misspell)
| // GetStatus extracts a status string from an error. | ||
| // Returns the success status string if err is nil. | ||
| // Traverses the error chain looking for a Status() method, | ||
| // falling back to the configured Statuser if none is found. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci] reported by reviewdog 🐶Statuser is a misspelling of Stature (misspell)
|
|
||
| func Cause(err error) error { return base.UnwrapAll(err) } | ||
| // Cause returns the root cause of an error by recursively unwrapping it. | ||
| func Cause(err error) error { return base.UnwrapAll(err) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci] reported by reviewdog 🐶
error returned from external package is unwrapped: sig: func github.com/upfluence/errors/base.UnwrapAll(err error) error (wrapcheck)
.: Implement WithStack2
| if input < 0 { | ||
| return Result{}, fmt.Errorf("negative input not allowed") | ||
| } | ||
| return Result{Value: input * 2}, nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci] reported by reviewdog 🐶
return with no blank line before (nlreturn)
What does this PR do?
Inspired by a discussion i had with @tgallice, i played a bit around with a LLM to improve the documentation, in a few prompt how can we get some doucmentation that could be both helpful for the lib users and and the lib author (having example that can be verified by the tests in the CI).
What are the observable changes?
Good PR checklist
Additional Notes