ocket8888 opened a new pull request, #7926:
URL: https://github.com/apache/trafficcontrol/pull/7926
This refactors `api.Handler` such that the return type is a single error
instead of a user-facing error, a system-facing error, and a status code. It
then handles the error specially if it is an `api.Errors` implementation. I
also updated usage accordingly throughout the two endpoint handling packages
that use `api.Wrap`.
Essentially this reduces
```go
code, userErr, sysErr := someCall(inf)
if userErr != nil || sysErr != nil {
return code, userErr, sysErr
}
```
to
```go
err := someCall(inf)
if err != nil {
return err
}
```
and
```go
err := tx.QueryRow("My query", args...)
if err != nil {
return http.StatusInternalServerError, nil, err
}
```
to
```go
err := tx.QueryRow("My query", args...)
if err != nil {
return err
}
```
<hr/>
## Which Traffic Control components are affected by this PR?
- Traffic Ops
## What is the best way to verify this PR?
This is just a refactor; behavior should be unchanged and the existing tests
should continue to pass.
## PR submission checklist
- [x] This PR has tests
- [x] This PR has documentation
- [x] This PR doesn't need a CHANGELOG.md entry
- [x] This PR **DOES NOT FIX A SERIOUS SECURITY VULNERABILITY**
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]