topcoder-platform / tc-project-service

16 stars 55 forks source link

Error handling for Bus API service #178

Open maxceem opened 6 years ago

maxceem commented 6 years ago

Currently, when errors happen during Bus API calls we don't get the actual error reason, but instead get Cannot read property 'data' of undefined, which doesn't have the information about the real error cause.

The reason for this is that here https://github.com/topcoder-platform/tc-project-service/blob/dev/src/services/busApi.js#L27 we ignore all the errors happen during Bus API calls and resolve the promise without passing any information about error further.

So if some error during Bus API call happens we anyway go to the .then handler https://github.com/topcoder-platform/tc-project-service/blob/dev/src/services/busApi.js#L55 and after error happen due to the fact that we don't have resp defined on this line https://github.com/topcoder-platform/tc-project-service/blob/dev/src/services/busApi.js#L57. This error Cannot read property 'data' of undefined is later catched and logged here https://github.com/topcoder-platform/tc-project-service/blob/dev/src/services/busApi.js#L59.

vikasrohit commented 6 years ago

Thanks @maxceem for capturing this.