We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I need help in setting error interceptor right. this is my error interceptor.
this is the actual error thats displayed in red colour font is
HTTP401: DENIED - The requested resource requires user authentication. (XHR)POST - https://192.168.43.95:8443/consumer/api/core/applications/application?id=16
The error that is reaching error interceptor is
In restangular error Interceptor app.module.ts (297,6) [object Error]: {description: "Object doesn't support property or method 'throw'", message: "Object doesn't support property or method 'throw'", number: -2146827850, stack: "TypeError: Object doesn't support property or method 'throw' at Anonymous function (http://localhost:8100/build/vendor.js:104509:13) at CatchSubscriber.prototype.error (http://localhost:8100/build/vendor.js:169123:17) at Subscriber.prototype._error (http://localhost:8100/build/vendor.js:26123:9) at Subscriber.prototype.error (http://localhost:8100/build/vendor.js:26103:13) at Subscriber.prototype._error (http://localhost:8100/build/vendor.js:26123:9) at Subscriber.prototype.error (http://localhost:8100/build/vendor.js:26103:13) at Subscriber.prototype._error (http://localhost:8100/build/vendor.js:26123:9) at Subscriber.prototype.error (http://localhost:8100/build/vendor.js:26103:13) at onLoad (http://localhost:8100/build/vendor.js:81319:21) at t.prototype.invokeTask (http://localhost:8100/build/polyfills.js:3:15536)"} description: "Object doesn't support property or method 'throw'" message: "Object doesn't support property or method 'throw'" number: -2146827850 stack: "TypeError: Object doesn't support property or method 'throw' at Anonymous function (http://localhost:8100/build/vendor.js:104509:13) at CatchSubscriber.prototype.error (http://localhost:8100/build/vendor.js:169123:17) at Subscriber.prototype._error (http://localhost:8100/build/vendor.js:26123:9) at Subscriber.prototype.error (http://localhost:8100/build/vendor.js:26103:13) at Subscriber.prototype._error (http://localhost:8100/build/vendor.js:26123:9) at Subscriber.prototype.error (http://localhost:8100/build/vendor.js:26103:13) at Subscriber.prototype._error (http://localhost:8100/build/vendor.js:26123:9) at Subscriber.prototype.error (http://localhost:8100/build/vendor.js:26103:13) at onLoad (http://localhost:8100/build/vendor.js:81319:21) at t.prototype.invokeTask (http://localhost:8100/build/polyfills.js:3:15536)" proto: Object
My Error interceptor is as follows.
RestangularConfigurer.addErrorInterceptor( (response, subject, responseHandler) => {
console.log("In restangular error Interceptor "); console.log( response );
if (response.status == 401) { console.error('Invalid Token Response - must reset.', response); return false; // error handled } else if (response.status === 0) { console.warn('Request failed with status of 0 - possible request interruption.', response); return false; // error handled }else { let title = 'Error'; // + response.status; let template = 'An unknown error occurred with your request. Please try again.'; if ( response.data && response.data.status) { title = response.data.status.responseTitle; template = response.data.status.responseMessage; } // Alert the user about the issue utilServiceProvider.presentAlert({ title: title, subTitle: template, buttons : ['OK'] }).then( response => { return true;}); return true; } });
This is my corresponding restangular post
requestApplication( applicationId : any) : Observable<any>{ return this.applicationEndpoint.post( this.request(), {id: applicationId}) .map(function( response , index, obs ) { return {'isMarkedFavourite' : response.isMarkedFavourite, data : response.data } } );
}
With Stack trace this is what is the stack
ERROR Message : Object doesn't support property or method 'throw' app.module.ts (311,11)
STACK : repeatRequest()@../../node_modules/ngx-restangular/dist/esm/src/ngx-restangular-http.js:44:0 error()@../../node_modules/rxjs/_esm5/internal/operators/catchError.js:33:0 _error()@../../node_modules/rxjs/_esm5/internal/Subscriber.js:80:0 error()@../../node_modules/rxjs/_esm5/internal/Subscriber.js:60:0 _error()@../../node_modules/rxjs/_esm5/internal/Subscriber.js:80:0 error()@../../node_modules/rxjs/_esm5/internal/Subscriber.js:60:0 _error()@../../node_modules/rxjs/_esm5/internal/Subscriber.js:80:0 error()@../../node_modules/rxjs/_esm5/internal/Subscriber.js:60:0 onLoad()@../../node_modules/@angular/common/fesm5/http.js:1558:0 t.prototype.invokeTask()@http://localhost:8100/build/polyfills.js:3:15536
The text was updated successfully, but these errors were encountered:
Package.json
"dependencies": { "@agm/core": "^1.0.0-beta.3", "@angular/animations": "^6.1.0", "@angular/cdk": "^6.3.3", "@angular/cli": "^6.1.1", "@angular/common": "6.1.0", "@angular/compiler": "6.1.0", "@angular/compiler-cli": "6.1.0", "@angular/core": "6.1.0", "@angular/forms": "6.1.0", "@angular/material": "^6.4.0", "@angular/platform-browser": "6.1.0", "@angular/platform-browser-dynamic": "6.1.0", "@angular/router": "^6.1.0", "@angular/tsc-wrapped": "^4.4.7", "@ionic-native/core": "3.12.1", "@ionic-native/splash-screen": "3.12.1", "@ionic-native/status-bar": "3.12.1", "@ionic/storage": "^2.1.3", "@types/googlemaps": "^3.30.10", "@types/lodash": "^4.14.109", "angular2-google-login": "^1.0.9", "angularx-social-login": "^1.2.1", "autoprefixer": "^9.0.1", "cordova-sqlite-storage": "^2.3.1", "ionic-angular": "^3.9.2", "ionic-native": "^2.9.0", "ionicons": "3.0.0", "jquery": "^3.3.1", "lodash": "^4.17.10", "ngx-restangular": "^2.2.3", "rxjs": "6.2.2", "rxjs-compat": "^6.0.0-rc.0", "slick-carousel": "^1.8.1", "stacktrace-js": "^2.0.0", "sw-toolbox": "3.6.0", "zone.js": "0.8.26" },
Sorry, something went wrong.
@sushmavy Please check the referenced issue for the solution. Notify me if the solutions don't work and I will investigate more and reopen the issue
No branches or pull requests
I need help in setting error interceptor right.
this is my error interceptor.
this is the actual error thats displayed in red colour font is
HTTP401: DENIED - The requested resource requires user authentication.
(XHR)POST - https://192.168.43.95:8443/consumer/api/core/applications/application?id=16
The error that is reaching error interceptor is
In restangular error Interceptor app.module.ts (297,6)
[object Error]: {description: "Object doesn't support property or method 'throw'", message: "Object doesn't support property or method 'throw'", number: -2146827850, stack: "TypeError: Object doesn't support property or method 'throw' at Anonymous function (http://localhost:8100/build/vendor.js:104509:13) at CatchSubscriber.prototype.error (http://localhost:8100/build/vendor.js:169123:17) at Subscriber.prototype._error (http://localhost:8100/build/vendor.js:26123:9) at Subscriber.prototype.error (http://localhost:8100/build/vendor.js:26103:13) at Subscriber.prototype._error (http://localhost:8100/build/vendor.js:26123:9) at Subscriber.prototype.error (http://localhost:8100/build/vendor.js:26103:13) at Subscriber.prototype._error (http://localhost:8100/build/vendor.js:26123:9) at Subscriber.prototype.error (http://localhost:8100/build/vendor.js:26103:13) at onLoad (http://localhost:8100/build/vendor.js:81319:21) at t.prototype.invokeTask (http://localhost:8100/build/polyfills.js:3:15536)"}
description: "Object doesn't support property or method 'throw'"
message: "Object doesn't support property or method 'throw'"
number: -2146827850
stack: "TypeError: Object doesn't support property or method 'throw' at Anonymous function (http://localhost:8100/build/vendor.js:104509:13) at CatchSubscriber.prototype.error (http://localhost:8100/build/vendor.js:169123:17) at Subscriber.prototype._error (http://localhost:8100/build/vendor.js:26123:9) at Subscriber.prototype.error (http://localhost:8100/build/vendor.js:26103:13) at Subscriber.prototype._error (http://localhost:8100/build/vendor.js:26123:9) at Subscriber.prototype.error (http://localhost:8100/build/vendor.js:26103:13) at Subscriber.prototype._error (http://localhost:8100/build/vendor.js:26123:9) at Subscriber.prototype.error (http://localhost:8100/build/vendor.js:26103:13) at onLoad (http://localhost:8100/build/vendor.js:81319:21) at t.prototype.invokeTask (http://localhost:8100/build/polyfills.js:3:15536)"
proto: Object
My Error interceptor is as follows.
RestangularConfigurer.addErrorInterceptor( (response, subject, responseHandler) => {
if (response.status == 401) {
console.error('Invalid Token Response - must reset.', response);
return false; // error handled
} else if (response.status === 0) {
console.warn('Request failed with status of 0 - possible request interruption.', response);
return false; // error handled
}else {
let title = 'Error'; // + response.status;
let template = 'An unknown error occurred with your request. Please try again.';
if ( response.data && response.data.status) {
title = response.data.status.responseTitle;
template = response.data.status.responseMessage;
}
// Alert the user about the issue
utilServiceProvider.presentAlert({
title: title,
subTitle: template,
buttons : ['OK']
}).then( response => { return true;});
return true;
}
});
This is my corresponding restangular post
}
With Stack trace this is what is the stack
ERROR Message : Object doesn't support property or method 'throw'
app.module.ts (311,11)
STACK : repeatRequest()@../../node_modules/ngx-restangular/dist/esm/src/ngx-restangular-http.js:44:0
error()@../../node_modules/rxjs/_esm5/internal/operators/catchError.js:33:0
_error()@../../node_modules/rxjs/_esm5/internal/Subscriber.js:80:0
error()@../../node_modules/rxjs/_esm5/internal/Subscriber.js:60:0
_error()@../../node_modules/rxjs/_esm5/internal/Subscriber.js:80:0
error()@../../node_modules/rxjs/_esm5/internal/Subscriber.js:60:0
_error()@../../node_modules/rxjs/_esm5/internal/Subscriber.js:80:0
error()@../../node_modules/rxjs/_esm5/internal/Subscriber.js:60:0
onLoad()@../../node_modules/@angular/common/fesm5/http.js:1558:0
t.prototype.invokeTask()@http://localhost:8100/build/polyfills.js:3:15536
The text was updated successfully, but these errors were encountered: