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:
@ -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.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user