]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/core/rest/rest-extractor.service.ts
Hide schedule privacy if private does not exist
[github/Chocobozzz/PeerTube.git] / client / src / app / core / rest / rest-extractor.service.ts
index 84d9ed074d4580b1348b6b2a262f6a9dba9af6cb..08ab495124885f3fe2f2f2210a28d94cf2cc5fdc 100644 (file)
@@ -41,7 +41,7 @@ export class RestExtractor {
 
     if (err.error instanceof Error) {
       // A client-side or network error occurred. Handle it accordingly.
-      errorMessage = err.error.message
+      errorMessage = err.error.detail || err.error.title
       console.error('An error occurred:', errorMessage)
     } else if (typeof err.error === 'string') {
       errorMessage = err.error
@@ -93,10 +93,10 @@ export class RestExtractor {
     return observableThrowError(errorObj)
   }
 
-  redirectTo404IfNotFound (obj: { status: number }, status = [ HttpStatusCode.NOT_FOUND_404 ]) {
+  redirectTo404IfNotFound (obj: { status: number }, type: 'video' | 'other', status = [ HttpStatusCode.NOT_FOUND_404 ]) {
     if (obj && obj.status && status.indexOf(obj.status) !== -1) {
       // Do not use redirectService to avoid circular dependencies
-      this.router.navigate([ '/404' ], { skipLocationChange: true })
+      this.router.navigate([ '/404' ], { state: { type, obj }, skipLocationChange: true })
     }
 
     return observableThrowError(obj)