Fix error handling and get tests back to working
This commit is contained in:
@@ -62,7 +62,7 @@ func (e *RequestError) SetMessage(msg string) *RequestError {
|
||||
func (e *RequestError) AbortWithStatus(status int, c *gin.Context) {
|
||||
// If this error is because the resource does not exist, we likely do not need to log
|
||||
// the error anywhere, just return a 404 and move on with our lives.
|
||||
if os.IsNotExist(e.Err) {
|
||||
if errors.Is(e.Err, os.ErrNotExist) {
|
||||
e.logger().WithField("error", e.Err).Debug("encountered os.IsNotExist error while handling request")
|
||||
|
||||
c.AbortWithStatusJSON(http.StatusNotFound, gin.H{
|
||||
|
||||
@@ -52,7 +52,7 @@ func getServerArchive(c *gin.Context) {
|
||||
|
||||
st, err := s.Archiver.Stat()
|
||||
if err != nil {
|
||||
if !os.IsNotExist(err) {
|
||||
if !errors.Is(err, os.ErrNotExist) {
|
||||
TrackedServerError(err, s).SetMessage("failed to stat archive").AbortWithServerError(c)
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user