Skip to content

Commit bf03ae7

Browse files
committed
more detailed errors
1 parent 11501c4 commit bf03ae7

File tree

3 files changed

+22
-3
lines changed

3 files changed

+22
-3
lines changed

models/actions/artifact.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,25 @@ const (
3030
ArtifactStatusDeleted // 6, ArtifactStatusDeleted is the status of an artifact that is deleted
3131
)
3232

33+
func (status ArtifactStatus) ToString() string {
34+
switch status {
35+
case ArtifactStatusUploadPending:
36+
return "upload is not yet completed"
37+
case ArtifactStatusUploadConfirmed:
38+
return "upload is completed"
39+
case ArtifactStatusUploadError:
40+
return "upload failed"
41+
case ArtifactStatusExpired:
42+
return "expired"
43+
case ArtifactStatusPendingDeletion:
44+
return "pending deletion"
45+
case ArtifactStatusDeleted:
46+
return "deleted"
47+
default:
48+
return "unknown"
49+
}
50+
}
51+
3352
func init() {
3453
db.RegisterModel(new(ActionArtifact))
3554
}

routers/api/actions/artifacts.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,7 @@ func (ar artifactRoutes) downloadArtifact(ctx *ArtifactContext) {
478478
return
479479
}
480480
if artifact.Status != actions.ArtifactStatusUploadConfirmed {
481-
log.Error("Error artifact not found: unconfirmed")
481+
log.Error("Error artifact not found: %s", artifact.Status.ToString())
482482
ctx.HTTPError(http.StatusNotFound, "Error artifact not found")
483483
return
484484
}

routers/api/actions/artifactsv4.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,7 @@ func (r *artifactV4Routes) getSignedArtifactURL(ctx *ArtifactContext) {
509509
return
510510
}
511511
if artifact.Status != actions.ArtifactStatusUploadConfirmed {
512-
log.Error("Error artifact not found: unconfirmed")
512+
log.Error("Error artifact not found: %s", artifact.Status.ToString())
513513
ctx.HTTPError(http.StatusNotFound, "Error artifact not found")
514514
return
515515
}
@@ -542,7 +542,7 @@ func (r *artifactV4Routes) downloadArtifact(ctx *ArtifactContext) {
542542
return
543543
}
544544
if artifact.Status != actions.ArtifactStatusUploadConfirmed {
545-
log.Error("Error artifact not found: unconfirmed")
545+
log.Error("Error artifact not found: %s", artifact.Status.ToString())
546546
ctx.HTTPError(http.StatusNotFound, "Error artifact not found")
547547
return
548548
}

0 commit comments

Comments
 (0)