Skip to content

Commit e2cc100

Browse files
committed
Provide a better error message
1 parent 7314135 commit e2cc100

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/DataSource.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,11 @@ export class DataSource extends DataSourceApi<MyQuery> {
130130
if (result.data instanceof String) {
131131
throw new Error(`${result.data}`);
132132
} else if (result.data.result_code !== 0) {
133-
throw new Error(`${result.data.result}`);
133+
let message = `${result.data}`;
134+
if (result.data.result !== undefined) {
135+
message = `${result.data.result}`;
136+
}
137+
throw new Error(message);
134138
} else {
135139
return result;
136140
}

0 commit comments

Comments
 (0)