Skip to content

Commit

Permalink
Include status code in HTTP error message (transloadit#3212)
Browse files Browse the repository at this point in the history
Makes it easier to debug when we can see it in the log files

e.g.
```
companion: 2021-09-20T20:03:53.226Z [error] provider.onedrive.list.error ProviderApiError: Access Denied
companion: 2021-09-20T19:57:49.897Z [error] provider.onedrive.list.error ProviderApiError: Item does not exist
```
We don't know what is the error code here...
  • Loading branch information
mifi committed Sep 30, 2021
1 parent 86f5015 commit 6f16804
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/server/provider/error.js
Expand Up @@ -8,7 +8,7 @@ class ProviderApiError extends Error {
* @param {number} statusCode the http status code from the provider api
*/
constructor (message, statusCode) {
super(message)
super(`HTTP ${statusCode}: ${message}`) // Include statusCode to make it easier to debug
this.name = 'ProviderApiError'
this.statusCode = statusCode
this.isAuthError = false
Expand Down

0 comments on commit 6f16804

Please sign in to comment.