Handle unknown errors in UI better.
@@ -285,17 +285,17 @@ export abstract class BaseService implements Service {
}
private unwrapErrorData(error: any): any {
- if (error.response && error.response.data) {
+ if (error && error.response && error.response.data) {
return {
message: error.message,
...error.response.data,
status: error.response.status
- };
+ }
} else if (error.response) {
return {
message: error.message,
status: error.response.status
- };
+ }
} else {
console.error("Unknown error detected: ", error);
return {
