Skip to content

Commit

Permalink
batches: File upload error handling (#1015)
Browse files Browse the repository at this point in the history
* Add the filename to the error to help determine which file is erroring

* Shadow the error to prevent the error being returned later on
  • Loading branch information
Piszmog committed Aug 7, 2023
1 parent b388f85 commit 7c5da8e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion cmd/src/batch_common.go
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,7 @@ func executeBatchSpec(ctx context.Context, opts executeBatchSpecOpts) (err error
}
if hasWorkspaceFiles {
execUI.UploadingWorkspaceFiles()
if err = svc.UploadBatchSpecWorkspaceFiles(ctx, batchSpecDir, string(id), batchSpec.Steps); err != nil {
if err := svc.UploadBatchSpecWorkspaceFiles(ctx, batchSpecDir, string(id), batchSpec.Steps); err != nil {
// Since failing to upload workspace files should not stop processing, just warn
execUI.UploadingWorkspaceFilesWarning(errors.Wrap(err, "uploading workspace files"))
} else {
Expand Down
2 changes: 1 addition & 1 deletion internal/batches/service/remote.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ func createFormFile(w *multipart.Writer, workingDir string, mountPath string) er
return err
}
if fileStat.Size() > maxFileSize {
return errors.New("file exceeds limit of 10MB")
return errors.Newf("file %q exceeds limit of 10MB", mountPath)
}

filePath, fileName := filepath.Split(mountPath)
Expand Down

0 comments on commit 7c5da8e

Please sign in to comment.