Only show one error at once (#2801)

* Do not show more than one error toast at a time

* use sha as file upload id

* again

* again

* again

* again

* fmt

* Hopefully fix flakiness

* move to macos-14-large

---------

Co-authored-by: Paul Tagliamonte <paul@zoo.dev>
Co-authored-by: Paul R. Tagliamonte <paul@kittycad.io>
This commit is contained in:
49fl
2024-06-26 14:04:23 -04:00
committed by GitHub
parent 68cdb68231
commit 0d4d7fa751
2 changed files with 24 additions and 12 deletions

View File

@ -29,7 +29,10 @@ export function cleanErrs<T>(
return [argsWOutErr.length !== value.length, argsWOutErr, argsWErr]
}
// Used to report errors to user at a certain point in execution
/**
* Used to report errors to user at a certain point in execution
* @returns boolean
*/
export function trap<T>(
value: ExcludeErr<T> | Error,
opts?: {
@ -43,6 +46,8 @@ export function trap<T>(
console.error(value)
opts?.suppress ||
toast.error((opts?.altErr ?? value ?? new Error('Unknown')).toString())
toast.error((opts?.altErr ?? value ?? new Error('Unknown')).toString(), {
id: 'error',
})
return true
}