There was an error while loading. Please reload this page.
1 parent e8632e9 commit 480a9f2Copy full SHA for 480a9f2
1 file changed
ui/src/stake/utils/errors.ts
@@ -1,13 +1,5 @@
1
export const toErrorString = (error: Error = new Error('Unknown error')) => {
2
- let errorString = ''
3
-
4
- if (Object.prototype.hasOwnProperty.call(error, 'message')) {
5
- errorString = (error as Error).message
6
- } else if (typeof error === 'object') {
7
- errorString = JSON.stringify(error)
8
- } else {
9
- errorString = error
10
- }
11
12
- return errorString
+ if ('message' in error) return error?.message
+ if (typeof error === 'object') return JSON.stringify(error)
+ return error
13
}
0 commit comments