Skip to content

Commit

Permalink
Include unhandled method in panic message (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickhayes-at authored Nov 21, 2024
1 parent ca32100 commit 0ac2429
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions services/s3/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,23 +30,23 @@ func NewHandler(logger *slog.Logger, s3 *S3) func(w http.ResponseWriter, r *http
case http.MethodDelete:
handle(w, r, logger.With("method", "DeleteBucketTagging"), s3.DeleteBucketTagging)
default:
panic("Unhandled method")
panic("Unhandled method: " + r.Method)
}
return true
} else if r.URL.Query().Has("delete") {
switch r.Method {
case http.MethodPost:
handle(w, r, logger.With("method", "DeleteObjects"), s3.DeleteObjects)
default:
panic("Unhandled method")
panic("Unhandled method: " + r.Method)
}
return true
} else if r.URL.Query().Get("list-type") == "2" {
switch r.Method {
case http.MethodGet:
handle(w, r, logger.With("method", "ListObjectsV2"), s3.ListObjectsV2)
default:
panic("Unhandled method")
panic("Unhandled method: " + r.Method)
}
return true
}
Expand Down Expand Up @@ -82,7 +82,7 @@ func NewHandler(logger *slog.Logger, s3 *S3) func(w http.ResponseWriter, r *http
logger.Debug("Got output", "method", "PutObject", "output", output, "error", awserr)
marshal(w, output, awserr)
default:
panic("Unhandled method")
panic("Unhandled method: " + r.Method)
}
}
if len(parts) == 2 {
Expand All @@ -95,15 +95,15 @@ func NewHandler(logger *slog.Logger, s3 *S3) func(w http.ResponseWriter, r *http
case http.MethodDelete:
handle(w, r, logger.With("method", "DeleteObjectTagging"), s3.DeleteObjectTagging)
default:
panic("Unhandled method")
panic("Unhandled method: " + r.Method)
}
return true
} else if r.URL.Query().Has("uploads") {
switch r.Method {
case http.MethodPost:
handle(w, r, logger.With("method", "CreateMultipartUpload"), s3.CreateMultipartUpload)
default:
panic("Unhandled method")
panic("Unhandled method: " + r.Method)
}
return true
} else if r.URL.Query().Has("uploadId") {
Expand All @@ -117,7 +117,7 @@ func NewHandler(logger *slog.Logger, s3 *S3) func(w http.ResponseWriter, r *http
case http.MethodGet:
handle(w, r, logger.With("method", "ListParts"), s3.ListParts)
default:
panic("Unhandled method")
panic("Unhandled method: " + r.Method)
}
return true
}
Expand All @@ -139,7 +139,7 @@ func NewHandler(logger *slog.Logger, s3 *S3) func(w http.ResponseWriter, r *http
case http.MethodDelete:
handle(w, r, logger.With("method", "DeleteObject"), s3.DeleteObject)
default:
panic("Unhandled method")
panic("Unhandled method: " + r.Method)
}
}
return true
Expand Down

0 comments on commit 0ac2429

Please sign in to comment.