We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 17c8d29 commit 4937cd3Copy full SHA for 4937cd3
src/utils/prepareErrorMessage.ts
@@ -4,8 +4,16 @@ export function prepareErrorMessage(error: unknown) {
4
}
5
6
if (error && typeof error === 'object') {
7
- if ('data' in error && typeof error.data === 'string') {
8
- return error.data;
+ if ('data' in error && error.data) {
+ if (typeof error.data === 'string') {
9
+ return error.data;
10
+ } else if (
11
+ typeof error.data === 'object' &&
12
+ 'message' in error.data &&
13
+ typeof error.data.message === 'string'
14
+ ) {
15
+ return error.data.message;
16
+ }
17
} else if ('statusText' in error && typeof error.statusText === 'string') {
18
return error.statusText;
19
} else if ('message' in error && typeof error.message === 'string') {
0 commit comments