mirror of
https://github.com/aljazceru/mutiny-web.git
synced 2026-01-29 02:54:19 +01:00
kitchen sink peer connect and channel create
This commit is contained in:
10
src/utils/eify.ts
Normal file
10
src/utils/eify.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
/// Sometimes we catch an error as `unknown` so this turns it into an Error.
|
||||
export default function eify(e: unknown): Error {
|
||||
if (e instanceof Error) {
|
||||
return e;
|
||||
} else if (typeof e === 'string') {
|
||||
return new Error(e);
|
||||
} else {
|
||||
return new Error('Unknown error');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user