Skip to content

Commit 7c5da8e

Browse files
authored
batches: File upload error handling (#1015)
* Add the filename to the error to help determine which file is erroring * Shadow the error to prevent the error being returned later on
1 parent b388f85 commit 7c5da8e

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

cmd/src/batch_common.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -535,7 +535,7 @@ func executeBatchSpec(ctx context.Context, opts executeBatchSpecOpts) (err error
535535
}
536536
if hasWorkspaceFiles {
537537
execUI.UploadingWorkspaceFiles()
538-
if err = svc.UploadBatchSpecWorkspaceFiles(ctx, batchSpecDir, string(id), batchSpec.Steps); err != nil {
538+
if err := svc.UploadBatchSpecWorkspaceFiles(ctx, batchSpecDir, string(id), batchSpec.Steps); err != nil {
539539
// Since failing to upload workspace files should not stop processing, just warn
540540
execUI.UploadingWorkspaceFilesWarning(errors.Wrap(err, "uploading workspace files"))
541541
} else {

internal/batches/service/remote.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ func createFormFile(w *multipart.Writer, workingDir string, mountPath string) er
213213
return err
214214
}
215215
if fileStat.Size() > maxFileSize {
216-
return errors.New("file exceeds limit of 10MB")
216+
return errors.Newf("file %q exceeds limit of 10MB", mountPath)
217217
}
218218

219219
filePath, fileName := filepath.Split(mountPath)

0 commit comments

Comments
 (0)