File tree Expand file tree Collapse file tree 2 files changed +10
-5
lines changed
apps/src/metabase/helpers Expand file tree Collapse file tree 2 files changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ import { RPCs, utils } from "web";
22
33const { getMetabaseState } = RPCs ;
44export const getSqlErrorMessage = async ( ) => {
5- let errorMessage = await getMetabaseState ( 'qb.queryResults[0].error' )
5+ let errorMessage : any = await getMetabaseState ( 'qb.queryResults[0].error' )
66 // check if errorMessage is a string, if so, return it
77 if ( typeof errorMessage === 'string' ) {
88 return errorMessage ;
@@ -12,11 +12,16 @@ export const getSqlErrorMessage = async () => {
1212 return undefined ;
1313 }
1414 // if errorMessage is an object, if so, check if it has status property and if its 0 return "query timed out"
15- if ( errorMessage && typeof errorMessage === 'object' && errorMessage . status === 0 ) {
16- return 'query timed out' ;
15+ if ( errorMessage && typeof errorMessage === 'object' ) {
16+ if ( errorMessage . status === 0 ) {
17+ return 'query timed out' ;
18+ }
19+ if ( errorMessage . data && typeof errorMessage . data === 'string' ) {
20+ return errorMessage . data ;
21+ }
1722 }
1823 // log error
19- console . warn ( "Error getting SQL error message" , errorMessage ) ;
24+ console . warn ( "Error getting SQL error message" , JSON . stringify ( errorMessage ) ) ;
2025 return 'unknown error' ;
2126}
2227
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ export function getTablesFromSql(sql: string): TableAndSchema[] {
1818 } ;
1919 } ) ;
2020 } catch ( error ) {
21- console . warn ( 'Error parsing SQL (maybe malformed):' , error ) ;
21+ console . warn ( 'Error parsing SQL (maybe malformed):' , sql , error ) ;
2222 return [ ] ;
2323 }
2424}
You can’t perform that action at this time.
0 commit comments