Skip to content

Commit

Permalink
Merge pull request #1 from Mythli/Mythli-patch-1
Browse files Browse the repository at this point in the history
fixed custom error messages
  • Loading branch information
Mythli authored Feb 10, 2020
2 parents 0f1e523 + 7a860dc commit 447c4f0
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 447c4f0

Please sign in to comment.