Skip to content

Commit

Permalink
Merge pull request #95 from Mythli/master
Browse files Browse the repository at this point in the history
fixed custom error messages
  • Loading branch information
dsternlicht committed Feb 10, 2020
2 parents 8cc2e28 + 447c4f0 commit 4a7ccbe
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/services/http.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,11 @@ class HttpService {
errorMessage = dataAtPath;
}
}
} catch {}
} catch {} // TODO: proper handling of errors (^.^)

errorMessage = `${res.status} - ${res.statusText || ''}`;

return errorMessage;
return errorMessage && errorMessage.length ?
errorMessage :
`${res.status} - ${res.statusText || ''}`;
}

private async handleError(res: Response) {
Expand Down Expand Up @@ -149,4 +149,4 @@ class HttpService {
}
}

export default HttpService;
export default HttpService;

0 comments on commit 4a7ccbe

Please sign in to comment.