fix(ui): propagate network failure
parent
5c1aac9ebb
commit
de2a15906a
|
@ -51,7 +51,8 @@ export const extractQueryErrorMessage = (errorMessage: string): string => {
|
|||
return 'Could not retrieve data'
|
||||
}
|
||||
|
||||
const parseErrorMatch = errorMessage.match('error parsing query')
|
||||
const parseErrorMatch =
|
||||
errorMessage.match && errorMessage.match('error parsing query')
|
||||
|
||||
if (parseErrorMatch) {
|
||||
return errorMessage.slice(parseErrorMatch.index)
|
||||
|
|
|
@ -93,7 +93,7 @@ async function AJAX<T = any>(
|
|||
headers = {},
|
||||
}: RequestParams,
|
||||
excludeBasepath = false
|
||||
): Promise<(T | T & {links: object}) | AxiosResponse<T>> {
|
||||
): Promise<(T | (T & {links: object})) | AxiosResponse<T>> {
|
||||
try {
|
||||
url = addBasepath(url, excludeBasepath)
|
||||
|
||||
|
@ -117,7 +117,11 @@ async function AJAX<T = any>(
|
|||
return links ? generateResponseWithLinks(response, links) : response
|
||||
} catch (error) {
|
||||
const {response} = error
|
||||
throw links ? generateResponseWithLinks(response, links) : response // eslint-disable-line no-throw-literal
|
||||
if (response) {
|
||||
throw links ? generateResponseWithLinks(response, links) : response // eslint-disable-line no-throw-literal
|
||||
} else {
|
||||
throw error
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue