File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -19,9 +19,13 @@ export class ErrorHandlerService {
1919 ) { }
2020
2121 showMessage ( error : ApiResponseError ) {
22+
2223 // in case of (internal) server error
23- if ( error . status === 0 || ( error . status > 499 && error . status < 600 ) ) {
24- const status = ( error . status === 0 ? 503 : error . status ) ;
24+ const apiServerError = ( error . error && error . error [ 'response' ] && error . error [ 'response' ] === null ) ;
25+
26+ if ( ( error . status > 499 && error . status < 600 ) || apiServerError ) {
27+
28+ const status = ( apiServerError ? 503 : error . status ) ;
2529
2630 // open error message in full size view
2731 const dialogConfig : MatDialogConfig = {
Original file line number Diff line number Diff line change @@ -17,14 +17,19 @@ export class NotificationService {
1717 // action: string = 'x', duration: number = 4200
1818 // and / or type: 'note' | 'warning' | 'error' | 'success'; which can be used for the panelClass
1919 openSnackBar ( notification : string | ApiResponseError ) : void {
20- const duration = 5000 ;
20+ let duration = 5000 ;
2121 let message : string ;
2222 let panelClass : string ;
2323
2424 if ( notification instanceof ApiResponseError ) {
25- const status = ( notification . status === 0 ? 503 : notification . status ) ;
26- const defaultStatusMsg = this . _statusMsg . default ;
27- message = `${ defaultStatusMsg [ status ] . message } (${ status } ): ${ defaultStatusMsg [ status ] . description } ` ;
25+ if ( notification . error && ! notification . error [ 'message' ] . startsWith ( 'ajax error' ) ) {
26+ // the Api response error contains a complex error message from dsp-js-lib
27+ message = notification . error [ 'message' ] ;
28+ duration = undefined ;
29+ } else {
30+ const defaultStatusMsg = this . _statusMsg . default ;
31+ message = `${ defaultStatusMsg [ notification . status ] . message } (${ notification . status } ): ${ defaultStatusMsg [ notification . status ] . description } ` ;
32+ }
2833 panelClass = 'error' ;
2934 } else {
3035 message = notification ;
Original file line number Diff line number Diff line change 7676 < p > Reasons:</ p >
7777 < ul >
7878 < li > It could be a deleted resource and does not exist anymore.</ li >
79+ < li > You don't have the permissions to open this resource.</ li >
7980 < li > The identifier or the ARK URL is wrong.</ li >
8081 </ ul >
8182 </ div >
You can’t perform that action at this time.
0 commit comments