Skip to content

Commit 3a3c745

Browse files
committed
align jobs errors with restangular errors
1 parent 860007f commit 3a3c745

File tree

4 files changed

+24
-4
lines changed

4 files changed

+24
-4
lines changed

dist/predicsis-jsSDK.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,17 @@ angular
2727
Restangular.setBaseUrl(this.getBaseUrl());
2828
Restangular.setDefaultHeaders({ accept: 'application/json', Authorization: 'Bearer ' + this.getOauthToken() });
2929
Restangular.setErrorInterceptor(function(response) { errorHandler(response); });
30-
jobsHelper.setErrorHandler(function(err) { errorHandler(err); });
30+
jobsHelper.setErrorHandler(function(err) {
31+
err = {
32+
data: {
33+
message: err.message,
34+
status: err.status,
35+
errors: [err]
36+
},
37+
status: err.status
38+
};
39+
errorHandler(err);
40+
});
3141
Restangular.addResponseInterceptor(function(data, operation, what, url, response) {
3242
//operation is one of 'getList', 'post', 'get', 'patch'
3343
if (['getList', 'post', 'get', 'patch'].indexOf(operation) > -1) {

0 commit comments

Comments
 (0)