summaryrefslogtreecommitdiffstats
path: root/routers/api/packages/composer/composer.go
diff options
context:
space:
mode:
Diffstat (limited to 'routers/api/packages/composer/composer.go')
-rw-r--r--routers/api/packages/composer/composer.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/routers/api/packages/composer/composer.go b/routers/api/packages/composer/composer.go
index 58571fff14..a623952aa7 100644
--- a/routers/api/packages/composer/composer.go
+++ b/routers/api/packages/composer/composer.go
@@ -4,6 +4,7 @@
package composer
import (
+ "errors"
"fmt"
"io"
"net/http"
@@ -200,7 +201,11 @@ func UploadPackage(ctx *context.Context) {
cp, err := composer_module.ParsePackage(buf, buf.Size())
if err != nil {
- apiError(ctx, http.StatusBadRequest, err)
+ if errors.Is(err, util.ErrInvalidArgument) {
+ apiError(ctx, http.StatusBadRequest, err)
+ } else {
+ apiError(ctx, http.StatusInternalServerError, err)
+ }
return
}