|
|
@ -280,7 +280,11 @@ export class AnalyticService { |
|
|
|
// xhrStatus may be one of: ('complete', 'error', 'timeout' or 'abort')
|
|
|
|
// xhrStatus may be one of: ('complete', 'error', 'timeout' or 'abort')
|
|
|
|
// See: https://github.com/angular/angular.js/blob/55075b840c9194b8524627a293d6166528b9a1c2/src/ng/http.js#L919-L920
|
|
|
|
// See: https://github.com/angular/angular.js/blob/55075b840c9194b8524627a293d6166528b9a1c2/src/ng/http.js#L919-L920
|
|
|
|
if(error.xhrStatus !== 'complete' || error.status > 500) { |
|
|
|
if(error.xhrStatus !== 'complete' || error.status > 500) { |
|
|
|
this.displayConnectionErrorAlert(); |
|
|
|
if(error.status === 504) { |
|
|
|
|
|
|
|
this.displayConnectionTimeoutAlert(); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
this.displayNoConnectionAlert(); |
|
|
|
|
|
|
|
} |
|
|
|
this._isUp = false; |
|
|
|
this._isUp = false; |
|
|
|
throw new Error(`Fetching error: ${error.status}: ${error.statusText}`); |
|
|
|
throw new Error(`Fetching error: ${error.status}: ${error.statusText}`); |
|
|
|
} else { |
|
|
|
} else { |
|
|
@ -323,7 +327,15 @@ export class AnalyticService { |
|
|
|
return this._analyticRequest('DELETE', url, data); |
|
|
|
return this._analyticRequest('DELETE', url, data); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private displayConnectionErrorAlert() { |
|
|
|
private displayNoConnectionAlert() { |
|
|
|
|
|
|
|
const message = [ |
|
|
|
|
|
|
|
'No connection to Hastic Server', |
|
|
|
|
|
|
|
`Hastic Datasource URL: "${this._hasticDatasourceURL}"`, |
|
|
|
|
|
|
|
] |
|
|
|
|
|
|
|
this._displayConnectionAlert(HasticDatasourceStatus.NOT_AVAILABLE, message); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private displayConnectionTimeoutAlert() { |
|
|
|
const message = [ |
|
|
|
const message = [ |
|
|
|
'Timeout when connecting to Hastic Server', |
|
|
|
'Timeout when connecting to Hastic Server', |
|
|
|
`Hastic Datasource URL: "${this._hasticDatasourceURL}"`, |
|
|
|
`Hastic Datasource URL: "${this._hasticDatasourceURL}"`, |
|
|
|