-
Notifications
You must be signed in to change notification settings - Fork 54
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
chore: Extract inline (http and client) errors to errors.go #967
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #967 +/- ##
===========================================
- Coverage 59.95% 59.86% -0.10%
===========================================
Files 157 157
Lines 17687 17716 +29
===========================================
+ Hits 10604 10605 +1
- Misses 6129 6157 +28
Partials 954 954
|
Splitting it up in multiple PRs is a good idea 👍 |
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.
LGTM. Just a nitpick and a minor suggestion.
api/http/errors.go
Outdated
ErrNoListener = errors.New("cannot serve with no listener") | ||
ErrSchema = errors.New("base must start with the http or https scheme") | ||
ErrDatabaseNotAvailable = errors.New("no database available") | ||
ErrXFormNotSupported = errors.New("content type application/x-www-form-urlencoded not yet supported") |
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.
nitpick: The X
can be removed in the name.
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.
thanks -wasnt sure what I could chop here
- drop X
@@ -21,9 +21,19 @@ import ( | |||
|
|||
var env = os.Getenv("DEFRA_ENV") | |||
|
|||
// Errors returnable from this package. |
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.
suggestion: Putting this here because I can't comment directly on the import. I think it would be a good idea to use Defra's errors
package instead of the stdlib one so that we can benefit from stacktraces.
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.
! good spot, I didnt notice - should definately be using our errors. Thanks
- use our errors
I realized that continuing this in this package would be ineffiecient as Orpheus is reworking it at the moment. He said (without seeing these changes) that it was still useful and shouldnt clash too hard, but I think it would be better to wait a bit to do the rest of the package.
0ebc396
to
f6bc237
Compare
…twork#967) * Move unexpected type error to client * Make existing http errors public * Extract http errors to errors.go * Extract some cli errors * Extract client errors
Relevant issue(s)
Part of #257
Description
Extracts inline errors to package errors.go for the http and client packages, and a couple of the ones in cli (see commit message for more info there).
My gut is staying to chunk this up into multiple PRs, but I dont want to spam you guys on a per-package basis. Will likely be doing this in 2-3 package chunks - do let me know your thoughts on this, the commits will be per package anyway, and the PRs will likely be based of one another so it doesnt really affect me personally too much one way or the other (minus any conflicts from larger merge-latency with larger PRs).