diff --git a/handler/dataprep/piece.go b/handler/dataprep/piece.go index 4c28e37fd..bde0d64f9 100644 --- a/handler/dataprep/piece.go +++ b/handler/dataprep/piece.go @@ -63,12 +63,12 @@ func (DefaultHandler) ListPiecesHandler( } var sourceAttachments []model.SourceAttachment err = db.Preload("Storage").Where("preparation_id = ?", preparation.ID).Find(&sourceAttachments).Error - if len(sourceAttachments) == 0 { - return nil, errors.Wrapf(handlererror.ErrNotFound, "preparation %d not found", id) - } if err != nil { return nil, errors.WithStack(err) } + if len(sourceAttachments) == 0 { + return nil, errors.Wrapf(handlererror.ErrNotFound, "preparation %s not found", id) + } var pieceLists []PieceList for _, sourceAttachment := range sourceAttachments {