Fix to not have unneeded console errors (#4482)

* Fix to not have unneeded console errors

* Change to use a type that isn't string
This commit is contained in:
Jonathan Tran
2024-11-19 17:34:54 -05:00
committed by GitHub
parent 54b5774f9e
commit 1a9926be8a
5 changed files with 52 additions and 18 deletions

View File

@ -2,6 +2,23 @@ import toast from 'react-hot-toast'
type ExcludeErr<T> = Exclude<T, Error>
/**
* Similar to Error, but more lightweight, without the stack trace. It can also
* be used to represent a reason for not being able to provide an alternative,
* which isn't necessarily an error.
*/
export class Reason {
message: string
constructor(message: string) {
this.message = message
}
toError() {
return new Error(this.message)
}
}
/**
* This is intentionally *not* exported due to misuse. We'd like to add a lint.
*/