Skip to content

ActivityPub-federated video streaming platform using P2P directly in your web browser

Reduce login on invalid token/token expiration

Chocobozzzd8dbde723916
diff --git a/client/src/app/+about/about-follows/about-follows.component.ts b/client/src/app/+about/about-follows/about-follows.component.ts
index a02e280b0b..91c0119675 100644
--- a/client/src/app/+about/about-follows/about-follows.component.ts
+++ b/client/src/app/+about/about-follows/about-follows.component.ts
@@ -101,7 +101,7 @@ export class AboutFollowsComponent implements OnInit {
this.followersPagination.totalItems = resultList.total
},
- error: err => this.notifier.error(err.message),
+ error: err => this.notifier.handleError(err),
complete: () => this.loadingFollowers = false
})
@@ -127,7 +127,7 @@ export class AboutFollowsComponent implements OnInit {
this.subscriptionsPagination.totalItems = resultList.total
},
- error: err => this.notifier.error(err.message),
+ error: err => this.notifier.handleError(err),
complete: () => this.loadingSubscriptions = false
})
diff --git a/client/src/app/+accounts/accounts.component.ts b/client/src/app/+accounts/accounts.component.ts
index c0d012627c..60a3301d90 100644
--- a/client/src/app/+accounts/accounts.component.ts
+++ b/client/src/app/+accounts/accounts.component.ts
@@ -108,7 +108,7 @@ export class AccountsComponent implements OnInit, OnDestroy {
this.videoChannels = videoChannels.data
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
this.links = [
@@ -213,7 +213,7 @@ export class AccountsComponent implements OnInit, OnDestroy {
this.accountUser = accountUser
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
}
diff --git a/client/src/app/+admin/config/pages/admin-config-homepage.component.ts b/client/src/app/+admin/config/pages/admin-config-homepage.component.ts
index 2e4034fd0b..18bb584c4f 100644
--- a/client/src/app/+admin/config/pages/admin-config-homepage.component.ts
+++ b/client/src/app/+admin/config/pages/admin-config-homepage.component.ts
@@ -59,7 +59,7 @@ export class AdminConfigHomepageComponent implements OnInit, CanComponentDeactiv
this.notifier.success($localize`Homepage updated.`)
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
diff --git a/client/src/app/+admin/config/pages/admin-config-logo.component.ts b/client/src/app/+admin/config/pages/admin-config-logo.component.ts
index 628c8bdf1c..ee54f966ca 100644
--- a/client/src/app/+admin/config/pages/admin-config-logo.component.ts
+++ b/client/src/app/+admin/config/pages/admin-config-logo.component.ts
@@ -135,7 +135,7 @@ export class AdminConfigLogoComponent implements OnInit, OnDestroy, CanComponent
this.form.markAsPristine()
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
diff --git a/client/src/app/+admin/follows/followers-list/followers-list.component.ts b/client/src/app/+admin/follows/followers-list/followers-list.component.ts
index 1b84e58889..0f784bbb60 100644
--- a/client/src/app/+admin/follows/followers-list/followers-list.component.ts
+++ b/client/src/app/+admin/follows/followers-list/followers-list.component.ts
@@ -85,7 +85,7 @@ export class FollowersListComponent implements OnInit {
this.table().loadData()
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
@@ -110,7 +110,7 @@ export class FollowersListComponent implements OnInit {
this.table().loadData()
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
@@ -141,7 +141,7 @@ export class FollowersListComponent implements OnInit {
this.table().loadData()
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
diff --git a/client/src/app/+admin/follows/following-list/follow-modal.component.ts b/client/src/app/+admin/follows/following-list/follow-modal.component.ts
index aae91977fd..6dcc7bf895 100644
--- a/client/src/app/+admin/follows/following-list/follow-modal.component.ts
+++ b/client/src/app/+admin/follows/following-list/follow-modal.component.ts
@@ -73,7 +73,7 @@ export class FollowModalComponent extends FormReactive implements OnInit {
this.newFollow.emit()
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
}
diff --git a/client/src/app/+admin/follows/following-list/following-list.component.ts b/client/src/app/+admin/follows/following-list/following-list.component.ts
index 12db804c64..d2550b9d64 100644
--- a/client/src/app/+admin/follows/following-list/following-list.component.ts
+++ b/client/src/app/+admin/follows/following-list/following-list.component.ts
@@ -100,7 +100,7 @@ export class FollowingListComponent implements OnInit {
this.table().loadData()
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
diff --git a/client/src/app/+admin/follows/shared/redundancy-checkbox.component.ts b/client/src/app/+admin/follows/shared/redundancy-checkbox.component.ts
index 2bc45d8851..42a37191ce 100644
--- a/client/src/app/+admin/follows/shared/redundancy-checkbox.component.ts
+++ b/client/src/app/+admin/follows/shared/redundancy-checkbox.component.ts
@@ -25,7 +25,7 @@ export class RedundancyCheckboxComponent {
this.notifier.success($localize`Redundancy for ${this.host()} is ${stateLabel}`)
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
}
diff --git a/client/src/app/+admin/follows/video-redundancies-list/video-redundancies-list.component.ts b/client/src/app/+admin/follows/video-redundancies-list/video-redundancies-list.component.ts
index ef1558bdbb..be80f8f235 100644
--- a/client/src/app/+admin/follows/video-redundancies-list/video-redundancies-list.component.ts
+++ b/client/src/app/+admin/follows/video-redundancies-list/video-redundancies-list.component.ts
@@ -179,7 +179,7 @@ export class VideoRedundanciesListComponent implements OnInit {
this.table().loadData()
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
diff --git a/client/src/app/+admin/moderation/registration-list/process-registration-modal.component.ts b/client/src/app/+admin/moderation/registration-list/process-registration-modal.component.ts
index 73f964a6eb..b3fbedc7cf 100644
--- a/client/src/app/+admin/moderation/registration-list/process-registration-modal.component.ts
+++ b/client/src/app/+admin/moderation/registration-list/process-registration-modal.component.ts
@@ -106,7 +106,7 @@ export class ProcessRegistrationModalComponent extends FormReactive implements O
this.hide()
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
@@ -123,7 +123,7 @@ export class ProcessRegistrationModalComponent extends FormReactive implements O
this.hide()
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
}
diff --git a/client/src/app/+admin/moderation/registration-list/registration-list.component.ts b/client/src/app/+admin/moderation/registration-list/registration-list.component.ts
index 61936dd8dc..7a7b01ac0c 100644
--- a/client/src/app/+admin/moderation/registration-list/registration-list.component.ts
+++ b/client/src/app/+admin/moderation/registration-list/registration-list.component.ts
@@ -156,7 +156,7 @@ export class RegistrationListComponent implements OnInit {
this.table().loadData()
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
diff --git a/client/src/app/+admin/moderation/video-block-list/video-block-list.component.ts b/client/src/app/+admin/moderation/video-block-list/video-block-list.component.ts
index 8e2897f710..6935f50361 100644
--- a/client/src/app/+admin/moderation/video-block-list/video-block-list.component.ts
+++ b/client/src/app/+admin/moderation/video-block-list/video-block-list.component.ts
@@ -93,7 +93,7 @@ export class VideoBlockListComponent implements OnInit {
this.table().loadData()
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
},
isDisplayed: videoBlock => videoBlock.type === VideoBlacklistType.AUTO_BEFORE_PUBLISHED
@@ -125,7 +125,7 @@ export class VideoBlockListComponent implements OnInit {
this.table().loadData()
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
}
@@ -159,7 +159,7 @@ export class VideoBlockListComponent implements OnInit {
this.table().loadData()
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
diff --git a/client/src/app/+admin/overview/users/user-edit/user-update.component.ts b/client/src/app/+admin/overview/users/user-edit/user-update.component.ts
index 35393cc6e5..6a6350ffc8 100644
--- a/client/src/app/+admin/overview/users/user-edit/user-update.component.ts
+++ b/client/src/app/+admin/overview/users/user-edit/user-update.component.ts
@@ -149,7 +149,7 @@ export class UserUpdateComponent extends UserEdit implements OnInit, OnDestroy {
this.notifier.success($localize`An email asking for password reset has been sent to ${this.user.username}.`)
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
@@ -162,7 +162,7 @@ export class UserUpdateComponent extends UserEdit implements OnInit, OnDestroy {
this.notifier.success($localize`Two factor authentication of ${this.user.username} disabled.`)
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
diff --git a/client/src/app/+admin/overview/users/user-list/user-list.component.ts b/client/src/app/+admin/overview/users/user-list/user-list.component.ts
index a9ea8a2ef9..cb3bde6ba5 100644
--- a/client/src/app/+admin/overview/users/user-list/user-list.component.ts
+++ b/client/src/app/+admin/overview/users/user-list/user-list.component.ts
@@ -221,7 +221,7 @@ export class UserListComponent implements OnInit, OnDestroy {
this.table().loadData()
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
@@ -251,7 +251,7 @@ export class UserListComponent implements OnInit, OnDestroy {
this.table().loadData()
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
@@ -269,7 +269,7 @@ export class UserListComponent implements OnInit, OnDestroy {
this.table().loadData()
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
@@ -285,7 +285,7 @@ export class UserListComponent implements OnInit, OnDestroy {
)
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
diff --git a/client/src/app/+admin/overview/videos/video-list.component.ts b/client/src/app/+admin/overview/videos/video-list.component.ts
index 22d79db9e7..16ce0dc93a 100644
--- a/client/src/app/+admin/overview/videos/video-list.component.ts
+++ b/client/src/app/+admin/overview/videos/video-list.component.ts
@@ -246,7 +246,7 @@ export class VideoListComponent implements OnInit {
this.table().loadData()
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
@@ -262,7 +262,7 @@ export class VideoListComponent implements OnInit {
this.table().loadData()
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
@@ -329,7 +329,7 @@ export class VideoListComponent implements OnInit {
this.table().loadData()
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
@@ -347,7 +347,7 @@ export class VideoListComponent implements OnInit {
this.table().loadData()
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
@@ -376,7 +376,7 @@ export class VideoListComponent implements OnInit {
this.table().loadData()
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
@@ -389,7 +389,7 @@ export class VideoListComponent implements OnInit {
this.table().loadData()
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
@@ -426,7 +426,7 @@ export class VideoListComponent implements OnInit {
}
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
}
diff --git a/client/src/app/+admin/plugins/plugin-list-installed/plugin-list-installed.component.ts b/client/src/app/+admin/plugins/plugin-list-installed/plugin-list-installed.component.ts
index a4ad8021d6..d3a3270fa6 100644
--- a/client/src/app/+admin/plugins/plugin-list-installed/plugin-list-installed.component.ts
+++ b/client/src/app/+admin/plugins/plugin-list-installed/plugin-list-installed.component.ts
@@ -78,7 +78,7 @@ export class PluginListInstalledComponent implements OnInit {
this.onDataSubject.next(res.data)
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
@@ -142,7 +142,7 @@ export class PluginListInstalledComponent implements OnInit {
},
error: err => {
- this.notifier.error(err.message)
+ this.notifier.handleError(err)
this.uninstalling[pluginKey] = false
}
})
@@ -176,7 +176,7 @@ export class PluginListInstalledComponent implements OnInit {
},
error: err => {
- this.notifier.error(err.message)
+ this.notifier.handleError(err)
this.updating[pluginKey] = false
}
})
diff --git a/client/src/app/+admin/plugins/plugin-search/plugin-search.component.ts b/client/src/app/+admin/plugins/plugin-search/plugin-search.component.ts
index cec815309d..aed2f42a2e 100644
--- a/client/src/app/+admin/plugins/plugin-search/plugin-search.component.ts
+++ b/client/src/app/+admin/plugins/plugin-search/plugin-search.component.ts
@@ -161,7 +161,7 @@ export class PluginSearchComponent implements OnInit {
error: err => {
this.installing[plugin.npmName] = false
- this.notifier.error(err.message)
+ this.notifier.handleError(err)
}
})
}
diff --git a/client/src/app/+admin/plugins/plugin-show-installed/plugin-show-installed.component.ts b/client/src/app/+admin/plugins/plugin-show-installed/plugin-show-installed.component.ts
index 898b6e6dab..6cbb9aefb5 100644
--- a/client/src/app/+admin/plugins/plugin-show-installed/plugin-show-installed.component.ts
+++ b/client/src/app/+admin/plugins/plugin-show-installed/plugin-show-installed.component.ts
@@ -56,7 +56,7 @@ export class PluginShowInstalledComponent extends FormReactive implements OnInit
this.notifier.success($localize`Settings updated.`)
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
@@ -103,7 +103,7 @@ export class PluginShowInstalledComponent extends FormReactive implements OnInit
this.buildSettingsForm()
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
diff --git a/client/src/app/+admin/system/debug/debug.component.ts b/client/src/app/+admin/system/debug/debug.component.ts
index 6d7ee71cf3..972ea3f329 100644
--- a/client/src/app/+admin/system/debug/debug.component.ts
+++ b/client/src/app/+admin/system/debug/debug.component.ts
@@ -30,7 +30,7 @@ export class DebugComponent implements OnInit {
.subscribe({
next: debug => this.debug = debug,
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
@@ -43,7 +43,7 @@ export class DebugComponent implements OnInit {
this.notifier.success($localize`Emails will be sent!`)
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
}
diff --git a/client/src/app/+admin/system/logs/logs.component.ts b/client/src/app/+admin/system/logs/logs.component.ts
index 70b8da26a9..8ba8d84152 100644
--- a/client/src/app/+admin/system/logs/logs.component.ts
+++ b/client/src/app/+admin/system/logs/logs.component.ts
@@ -89,7 +89,7 @@ export class LogsComponent implements OnInit {
})
},
- error: err => this.notifier.error(err.message),
+ error: err => this.notifier.handleError(err),
complete: () => this.loading = false
})
diff --git a/client/src/app/+admin/system/runners/runner-job-list/runner-job-list.component.ts b/client/src/app/+admin/system/runners/runner-job-list/runner-job-list.component.ts
index eee5afda3c..25d53d912a 100644
--- a/client/src/app/+admin/system/runners/runner-job-list/runner-job-list.component.ts
+++ b/client/src/app/+admin/system/runners/runner-job-list/runner-job-list.component.ts
@@ -132,7 +132,7 @@ export class RunnerJobListComponent implements OnInit {
)
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
@@ -159,7 +159,7 @@ export class RunnerJobListComponent implements OnInit {
)
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
diff --git a/client/src/app/+admin/system/runners/runner-list/runner-list.component.ts b/client/src/app/+admin/system/runners/runner-list/runner-list.component.ts
index b0eb9373e8..35df059ec1 100644
--- a/client/src/app/+admin/system/runners/runner-list/runner-list.component.ts
+++ b/client/src/app/+admin/system/runners/runner-list/runner-list.component.ts
@@ -1,4 +1,3 @@
-
import { Component, OnInit, inject, viewChild } from '@angular/core'
import { ConfirmService, Notifier } from '@app/core'
import { PTDatePipe } from '@app/shared/shared-main/common/date.pipe'
@@ -16,7 +15,7 @@ import { RunnerService } from '../runner.service'
PTDatePipe,
TableComponent,
NumberFormatterPipe
-]
+ ]
})
export class RunnerListComponent implements OnInit {
private runnerService = inject(RunnerService)
@@ -68,7 +67,7 @@ export class RunnerListComponent implements OnInit {
this.notifier.success($localize`Runner removed.`)
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
diff --git a/client/src/app/+admin/system/runners/runner-registration-token-list/runner-registration-token-list.component.ts b/client/src/app/+admin/system/runners/runner-registration-token-list/runner-registration-token-list.component.ts
index 89c0cc9bcf..3bbf75dd17 100644
--- a/client/src/app/+admin/system/runners/runner-registration-token-list/runner-registration-token-list.component.ts
+++ b/client/src/app/+admin/system/runners/runner-registration-token-list/runner-registration-token-list.component.ts
@@ -1,4 +1,3 @@
-
import { Component, OnInit, inject, viewChild } from '@angular/core'
import { ConfirmService, Notifier } from '@app/core'
import { PTDatePipe } from '@app/shared/shared-main/common/date.pipe'
@@ -21,7 +20,7 @@ import { RunnerService } from '../runner.service'
PTDatePipe,
NumberFormatterPipe,
TableComponent
-]
+ ]
})
export class RunnerRegistrationTokenListComponent implements OnInit {
private runnerService = inject(RunnerService)
@@ -63,7 +62,7 @@ export class RunnerRegistrationTokenListComponent implements OnInit {
this.notifier.success($localize`Registration token generated.`)
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
@@ -82,7 +81,7 @@ export class RunnerRegistrationTokenListComponent implements OnInit {
this.notifier.success($localize`Registration token removed.`)
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
diff --git a/client/src/app/+login/login.component.ts b/client/src/app/+login/login.component.ts
index 09b41937ef..18117927e3 100644
--- a/client/src/app/+login/login.component.ts
+++ b/client/src/app/+login/login.component.ts
@@ -188,7 +188,7 @@ The link will expire within 1 hour.`
this.hideForgotPasswordModal()
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
diff --git a/client/src/app/+my-account/my-account-applications/my-account-applications.component.ts b/client/src/app/+my-account/my-account-applications/my-account-applications.component.ts
index 29b613a556..9e7b6ea0b7 100644
--- a/client/src/app/+my-account/my-account-applications/my-account-applications.component.ts
+++ b/client/src/app/+my-account/my-account-applications/my-account-applications.component.ts
@@ -30,7 +30,7 @@ export class MyAccountApplicationsComponent implements OnInit {
.subscribe({
next: tokens => this.regenApplications(tokens),
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
@@ -49,7 +49,7 @@ export class MyAccountApplicationsComponent implements OnInit {
this.notifier.success($localize`Token renewed. Update your client configuration accordingly.`)
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
diff --git a/client/src/app/+my-account/my-account-settings/my-account-danger-zone/my-account-danger-zone.component.ts b/client/src/app/+my-account/my-account-settings/my-account-danger-zone/my-account-danger-zone.component.ts
index 444f9a0671..ef922069a7 100644
--- a/client/src/app/+my-account/my-account-settings/my-account-danger-zone/my-account-danger-zone.component.ts
+++ b/client/src/app/+my-account/my-account-settings/my-account-danger-zone/my-account-danger-zone.component.ts
@@ -39,7 +39,7 @@ export class MyAccountDangerZoneComponent {
this.redirectService.redirectToHomepage()
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
}
diff --git a/client/src/app/+my-account/my-account-settings/my-account-email-preferences/my-account-email-preferences.component.ts b/client/src/app/+my-account/my-account-settings/my-account-email-preferences/my-account-email-preferences.component.ts
index a3d731936c..846eba1fbe 100644
--- a/client/src/app/+my-account/my-account-settings/my-account-email-preferences/my-account-email-preferences.component.ts
+++ b/client/src/app/+my-account/my-account-settings/my-account-email-preferences/my-account-email-preferences.component.ts
@@ -46,7 +46,7 @@ export class MyAccountEmailPreferencesComponent extends FormReactive implements
this.user.update(u => ({ ...u, emailPublic: details.emailPublic }))
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
}
diff --git a/client/src/app/+my-account/my-account-settings/my-account-notification-preferences/my-account-notification-preferences.component.ts b/client/src/app/+my-account/my-account-settings/my-account-notification-preferences/my-account-notification-preferences.component.ts
index 410d962975..3a356bd6f1 100644
--- a/client/src/app/+my-account/my-account-settings/my-account-notification-preferences/my-account-notification-preferences.component.ts
+++ b/client/src/app/+my-account/my-account-settings/my-account-notification-preferences/my-account-notification-preferences.component.ts
@@ -165,7 +165,7 @@ export class MyAccountNotificationPreferencesComponent implements OnInit {
this.notifier.success($localize`Preferences saved`, undefined, 2000)
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
diff --git a/client/src/app/+my-account/my-account-settings/my-account-two-factor/my-account-two-factor-button.component.ts b/client/src/app/+my-account/my-account-settings/my-account-two-factor/my-account-two-factor-button.component.ts
index 868e470151..b3dbbf08a9 100644
--- a/client/src/app/+my-account/my-account-settings/my-account-two-factor/my-account-two-factor-button.component.ts
+++ b/client/src/app/+my-account/my-account-settings/my-account-two-factor/my-account-two-factor-button.component.ts
@@ -38,7 +38,7 @@ export class MyAccountTwoFactorButtonComponent implements OnInit {
this.notifier.success($localize`Two factor authentication disabled`)
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
}
diff --git a/client/src/app/+my-account/my-account-settings/my-account-two-factor/my-account-two-factor.component.ts b/client/src/app/+my-account/my-account-settings/my-account-two-factor/my-account-two-factor.component.ts
index 3bb8ab12a4..786a174ce9 100644
--- a/client/src/app/+my-account/my-account-settings/my-account-two-factor/my-account-two-factor.component.ts
+++ b/client/src/app/+my-account/my-account-settings/my-account-two-factor/my-account-two-factor.component.ts
@@ -61,7 +61,7 @@ export class MyAccountTwoFactorComponent implements OnInit {
this.step = 'confirm'
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
@@ -79,7 +79,7 @@ export class MyAccountTwoFactorComponent implements OnInit {
this.router.navigateByUrl('/my-account/settings')
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
diff --git a/client/src/app/+my-library/+my-video-channels/edit/pages/video-channel-activities.component.ts b/client/src/app/+my-library/+my-video-channels/edit/pages/video-channel-activities.component.ts
index 5e454ef8da..b460e7fe63 100644
--- a/client/src/app/+my-library/+my-video-channels/edit/pages/video-channel-activities.component.ts
+++ b/client/src/app/+my-library/+my-video-channels/edit/pages/video-channel-activities.component.ts
@@ -90,7 +90,7 @@ export class VideoChannelActivitiesComponent implements OnInit, OnDestroy {
this.onDataSubject.next(res.data)
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
}
diff --git a/client/src/app/+my-library/+my-video-channels/edit/pages/video-channel-editors.component.ts b/client/src/app/+my-library/+my-video-channels/edit/pages/video-channel-editors.component.ts
index 62c449170c..8243d6aa08 100644
--- a/client/src/app/+my-library/+my-video-channels/edit/pages/video-channel-editors.component.ts
+++ b/client/src/app/+my-library/+my-video-channels/edit/pages/video-channel-editors.component.ts
@@ -1,4 +1,3 @@
-
import { Component, inject, OnDestroy, OnInit } from '@angular/core'
import { FormsModule, ReactiveFormsModule } from '@angular/forms'
import { Router } from '@angular/router'
@@ -29,7 +28,7 @@ import { VideoChannelEdit } from '../video-channel-edit.model'
UserAutoCompleteComponent,
GlobalIconComponent,
CollaboratorStateComponent
-]
+ ]
})
export class VideoChannelEditEditorsComponent implements OnInit, OnDestroy {
private confirmService = inject(ConfirmService)
@@ -92,7 +91,7 @@ export class VideoChannelEditEditorsComponent implements OnInit, OnDestroy {
}
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
}
@@ -143,7 +142,7 @@ export class VideoChannelEditEditorsComponent implements OnInit, OnDestroy {
this.newEditorUsername = ''
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
}
diff --git a/client/src/app/+my-library/+my-video-channels/my-video-channels.component.ts b/client/src/app/+my-library/+my-video-channels/my-video-channels.component.ts
index 79409dfddc..d361fa904a 100644
--- a/client/src/app/+my-library/+my-video-channels/my-video-channels.component.ts
+++ b/client/src/app/+my-library/+my-video-channels/my-video-channels.component.ts
@@ -158,7 +158,7 @@ export class MyVideoChannelsComponent implements OnInit {
updatePaginationOnDelete(this.pagination)
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
@@ -217,7 +217,7 @@ export class MyVideoChannelsComponent implements OnInit {
this.onChannelDataSubject.next(res.data)
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
diff --git a/client/src/app/+my-library/my-auto-tag-policies/my-auto-tag-policies.component.ts b/client/src/app/+my-library/my-auto-tag-policies/my-auto-tag-policies.component.ts
index 4984ee02f3..53ca256a41 100644
--- a/client/src/app/+my-library/my-auto-tag-policies/my-auto-tag-policies.component.ts
+++ b/client/src/app/+my-library/my-auto-tag-policies/my-auto-tag-policies.component.ts
@@ -44,7 +44,7 @@ export class MyAutoTagPoliciesComponent implements OnInit {
this.notifier.success($localize`Comment policies updated`)
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
diff --git a/client/src/app/+my-library/my-follows/my-followers.component.ts b/client/src/app/+my-library/my-follows/my-followers.component.ts
index 35ad1b60e1..dbcfbf1a46 100644
--- a/client/src/app/+my-library/my-follows/my-followers.component.ts
+++ b/client/src/app/+my-library/my-follows/my-followers.component.ts
@@ -95,7 +95,7 @@ export class MyFollowersComponent implements OnInit {
this.onDataSubject.next(res.data)
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
diff --git a/client/src/app/+my-library/my-follows/my-subscriptions.component.ts b/client/src/app/+my-library/my-follows/my-subscriptions.component.ts
index bcd6b7c4da..f4940e2b1a 100644
--- a/client/src/app/+my-library/my-follows/my-subscriptions.component.ts
+++ b/client/src/app/+my-library/my-follows/my-subscriptions.component.ts
@@ -71,7 +71,7 @@ export class MySubscriptionsComponent {
this.onDataSubject.next(res.data)
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
}
diff --git a/client/src/app/+my-library/my-history/my-history.component.ts b/client/src/app/+my-library/my-history/my-history.component.ts
index 60c35f1863..b86e36a4c5 100644
--- a/client/src/app/+my-library/my-history/my-history.component.ts
+++ b/client/src/app/+my-library/my-history/my-history.component.ts
@@ -127,7 +127,7 @@ export class MyHistoryComponent implements OnInit, DisableForReuseHook {
this.authService.refreshUserInformation()
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
@@ -139,7 +139,7 @@ export class MyHistoryComponent implements OnInit, DisableForReuseHook {
updatePaginationOnDelete(this.pagination)
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
@@ -158,7 +158,7 @@ export class MyHistoryComponent implements OnInit, DisableForReuseHook {
this.reloadData()
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
diff --git a/client/src/app/+my-library/my-ownership/my-accept-ownership/my-accept-ownership.component.ts b/client/src/app/+my-library/my-ownership/my-accept-ownership/my-accept-ownership.component.ts
index 05ae8a22a3..0a3d245552 100644
--- a/client/src/app/+my-library/my-ownership/my-accept-ownership/my-accept-ownership.component.ts
+++ b/client/src/app/+my-library/my-ownership/my-accept-ownership/my-accept-ownership.component.ts
@@ -74,7 +74,7 @@ export class MyAcceptOwnershipComponent extends FormReactive implements OnInit {
this.videoChangeOwnership = undefined
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
}
diff --git a/client/src/app/+my-library/my-ownership/my-ownership.component.ts b/client/src/app/+my-library/my-ownership/my-ownership.component.ts
index 8cc4e81c5d..13fec434b2 100644
--- a/client/src/app/+my-library/my-ownership/my-ownership.component.ts
+++ b/client/src/app/+my-library/my-ownership/my-ownership.component.ts
@@ -70,7 +70,7 @@ export class MyOwnershipComponent {
this.videoOwnershipService.refuseOwnership(videoChangeOwnership.id)
.subscribe({
next: () => this.table().loadData(),
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
diff --git a/client/src/app/+my-library/my-video-channel-syncs/my-video-channel-syncs.component.ts b/client/src/app/+my-library/my-video-channel-syncs/my-video-channel-syncs.component.ts
index 6d940734fb..c67689437c 100644
--- a/client/src/app/+my-library/my-video-channel-syncs/my-video-channel-syncs.component.ts
+++ b/client/src/app/+my-library/my-video-channel-syncs/my-video-channel-syncs.component.ts
@@ -118,7 +118,7 @@ export class MyVideoChannelSyncsComponent implements OnInit {
this.notifier.success($localize`Synchronization removed successfully for ${videoChannelSync.channel.displayName}.`)
this.table().loadData()
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
@@ -128,7 +128,7 @@ export class MyVideoChannelSyncsComponent implements OnInit {
next: () => {
this.notifier.success($localize`Full synchronization requested successfully for ${videoChannelSync.channel.displayName}.`)
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
diff --git a/client/src/app/+my-library/my-video-imports/my-video-imports.component.ts b/client/src/app/+my-library/my-video-imports/my-video-imports.component.ts
index f3fb7ee72a..cad4c27abe 100644
--- a/client/src/app/+my-library/my-video-imports/my-video-imports.component.ts
+++ b/client/src/app/+my-library/my-video-imports/my-video-imports.component.ts
@@ -127,7 +127,7 @@ export class MyVideoImportsComponent implements OnInit {
.subscribe({
next: () => this.table().loadData(),
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
@@ -136,7 +136,7 @@ export class MyVideoImportsComponent implements OnInit {
.subscribe({
next: () => this.table().loadData(),
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
@@ -145,7 +145,7 @@ export class MyVideoImportsComponent implements OnInit {
.subscribe({
next: () => this.table().loadData(),
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
diff --git a/client/src/app/+my-library/my-video-playlists/my-video-playlist-elements.component.ts b/client/src/app/+my-library/my-video-playlists/my-video-playlist-elements.component.ts
index 6aad8ba858..f83fb6dc1b 100644
--- a/client/src/app/+my-library/my-video-playlists/my-video-playlist-elements.component.ts
+++ b/client/src/app/+my-library/my-video-playlists/my-video-playlist-elements.component.ts
@@ -105,7 +105,7 @@ export class MyVideoPlaylistElementsComponent implements OnInit, OnDestroy {
this.reorderClientPositions()
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
@@ -151,7 +151,7 @@ export class MyVideoPlaylistElementsComponent implements OnInit, OnDestroy {
this.notifier.success($localize`Playlist ${videoPlaylist.displayName} deleted.`)
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
diff --git a/client/src/app/+my-library/my-video-playlists/my-video-playlists.component.ts b/client/src/app/+my-library/my-video-playlists/my-video-playlists.component.ts
index 62cc4145b5..b6fbaa915d 100644
--- a/client/src/app/+my-library/my-video-playlists/my-video-playlists.component.ts
+++ b/client/src/app/+my-library/my-video-playlists/my-video-playlists.component.ts
@@ -156,7 +156,7 @@ export class MyVideoPlaylistsComponent implements OnInit, OnDestroy {
this.notifier.success($localize`Playlist ${videoPlaylist.displayName} deleted.`)
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
@@ -197,7 +197,7 @@ export class MyVideoPlaylistsComponent implements OnInit, OnDestroy {
this.notifier.success($localize`Playlists reordered`)
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
diff --git a/client/src/app/+my-library/my-videos/modals/video-change-ownership.component.ts b/client/src/app/+my-library/my-videos/modals/video-change-ownership.component.ts
index 6dda8a47e9..d791b3f59b 100644
--- a/client/src/app/+my-library/my-videos/modals/video-change-ownership.component.ts
+++ b/client/src/app/+my-library/my-videos/modals/video-change-ownership.component.ts
@@ -53,7 +53,7 @@ export class VideoChangeOwnershipComponent extends FormReactive implements OnIni
this.requestSent.emit(username)
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
}
diff --git a/client/src/app/+my-library/my-videos/my-videos.component.ts b/client/src/app/+my-library/my-videos/my-videos.component.ts
index 4b8444d6ea..3bae118d14 100644
--- a/client/src/app/+my-library/my-videos/my-videos.component.ts
+++ b/client/src/app/+my-library/my-videos/my-videos.component.ts
@@ -318,7 +318,7 @@ export class MyVideosComponent implements OnInit, OnDestroy {
this.table().loadData()
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
diff --git a/client/src/app/+reset-password/reset-password.component.ts b/client/src/app/+reset-password/reset-password.component.ts
index e7538dd92f..a014fb50db 100644
--- a/client/src/app/+reset-password/reset-password.component.ts
+++ b/client/src/app/+reset-password/reset-password.component.ts
@@ -50,7 +50,7 @@ export class ResetPasswordComponent extends FormReactive implements OnInit {
this.router.navigate([ '/login' ])
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
diff --git a/client/src/app/+search/search.component.ts b/client/src/app/+search/search.component.ts
index 822481d909..6c5719d58f 100644
--- a/client/src/app/+search/search.component.ts
+++ b/client/src/app/+search/search.component.ts
@@ -123,7 +123,7 @@ export class SearchComponent implements OnInit, OnDestroy {
this.search()
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
this.userService.getAnonymousOrLoggedUser()
diff --git a/client/src/app/+signup/+verify-account/verify-account-email/verify-account-email.component.ts b/client/src/app/+signup/+verify-account/verify-account-email/verify-account-email.component.ts
index a4a356762a..c2797c1a68 100644
--- a/client/src/app/+signup/+verify-account/verify-account-email/verify-account-email.component.ts
+++ b/client/src/app/+signup/+verify-account/verify-account-email/verify-account-email.component.ts
@@ -96,7 +96,7 @@ export class VerifyAccountEmailComponent implements OnInit {
error: err => {
this.failed = true
- this.notifier.error(err.message)
+ this.notifier.handleError(err)
}
})
}
@@ -116,7 +116,7 @@ export class VerifyAccountEmailComponent implements OnInit {
error: err => {
this.failed = true
- this.notifier.error(err.message)
+ this.notifier.handleError(err)
}
})
}
diff --git a/client/src/app/+signup/+verify-account/verify-new-account-ask-send-email/verify-new-account-ask-send-email.component.ts b/client/src/app/+signup/+verify-account/verify-new-account-ask-send-email/verify-new-account-ask-send-email.component.ts
index c082f879a1..223eb279e5 100644
--- a/client/src/app/+signup/+verify-account/verify-new-account-ask-send-email/verify-new-account-ask-send-email.component.ts
+++ b/client/src/app/+signup/+verify-account/verify-new-account-ask-send-email/verify-new-account-ask-send-email.component.ts
@@ -51,7 +51,7 @@ export class VerifyNewAccountAskSendEmailComponent extends FormReactive implemen
this.redirectService.redirectToHomepage()
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
}
diff --git a/client/src/app/+video-list/overview/video-overview.component.ts b/client/src/app/+video-list/overview/video-overview.component.ts
index 6e577c2bbc..868223a281 100644
--- a/client/src/app/+video-list/overview/video-overview.component.ts
+++ b/client/src/app/+video-list/overview/video-overview.component.ts
@@ -181,7 +181,7 @@ export class VideoOverviewComponent implements OnInit, OnDestroy, AfterViewCheck
},
error: err => {
- this.notifier.error(err.message)
+ this.notifier.handleError(err)
this.isLoading = false
}
})
diff --git a/client/src/app/+video-watch/shared/action-buttons/video-rate.component.ts b/client/src/app/+video-watch/shared/action-buttons/video-rate.component.ts
index c8ca14eae7..b9ed00b73c 100644
--- a/client/src/app/+video-watch/shared/action-buttons/video-rate.component.ts
+++ b/client/src/app/+video-watch/shared/action-buttons/video-rate.component.ts
@@ -102,7 +102,7 @@ export class VideoRateComponent implements OnInit, OnChanges, OnDestroy {
this.userRatingLoaded.emit(this.userRating)
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
@@ -122,7 +122,7 @@ export class VideoRateComponent implements OnInit, OnChanges, OnDestroy {
this.rateUpdated.emit(this.userRating)
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
diff --git a/client/src/app/+video-watch/shared/comment/video-comment-add.component.ts b/client/src/app/+video-watch/shared/comment/video-comment-add.component.ts
index b4a846c8e0..5bc8ab5614 100644
--- a/client/src/app/+video-watch/shared/comment/video-comment-add.component.ts
+++ b/client/src/app/+video-watch/shared/comment/video-comment-add.component.ts
@@ -151,7 +151,7 @@ export class VideoCommentAddComponent extends FormReactive implements OnChanges,
error: err => {
this.addingComment = false
- this.notifier.error(err.message)
+ this.notifier.handleError(err)
}
})
}
diff --git a/client/src/app/+video-watch/shared/comment/video-comment.component.ts b/client/src/app/+video-watch/shared/comment/video-comment.component.ts
index 8a1930806d..89c9d904bd 100644
--- a/client/src/app/+video-watch/shared/comment/video-comment.component.ts
+++ b/client/src/app/+video-watch/shared/comment/video-comment.component.ts
@@ -187,7 +187,7 @@ export class VideoCommentComponent implements OnInit, OnChanges {
.subscribe({
next: user => this.commentUser = user,
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
}
diff --git a/client/src/app/+video-watch/shared/comment/video-comments.component.ts b/client/src/app/+video-watch/shared/comment/video-comments.component.ts
index bbe52de0ad..f38b1104c2 100644
--- a/client/src/app/+video-watch/shared/comment/video-comments.component.ts
+++ b/client/src/app/+video-watch/shared/comment/video-comments.component.ts
@@ -1,4 +1,3 @@
-
import { Component, ElementRef, inject, input, OnChanges, OnDestroy, OnInit, output, SimpleChanges, viewChild } from '@angular/core'
import { ActivatedRoute } from '@angular/router'
import { AuthService, ComponentPagination, ConfirmService, hasMoreItems, Notifier, PluginService, User } from '@app/core'
@@ -32,7 +31,7 @@ import { VideoCommentComponent } from './video-comment.component'
InfiniteScrollerDirective,
VideoCommentComponent,
LoaderComponent
-]
+ ]
})
export class VideoCommentsComponent implements OnInit, OnChanges, OnDestroy {
private authService = inject(AuthService)
@@ -140,7 +139,7 @@ export class VideoCommentsComponent implements OnInit, OnChanges, OnDestroy {
const errorBody = err.body as PeerTubeProblemDocument
if (highlightThread && errorBody?.code === ServerErrorCode.COMMENT_NOT_ASSOCIATED_TO_VIDEO) return
- this.notifier.error(err.message)
+ this.notifier.handleError(err)
}
})
}
@@ -237,7 +236,7 @@ export class VideoCommentsComponent implements OnInit, OnChanges, OnDestroy {
this.softDeleteComment(commentToDelete)
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
return true
@@ -273,7 +272,7 @@ export class VideoCommentsComponent implements OnInit, OnChanges, OnDestroy {
this.notifier.success($localize`Comment approved`)
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
diff --git a/client/src/app/+video-watch/shared/player-widgets/video-transcription.component.ts b/client/src/app/+video-watch/shared/player-widgets/video-transcription.component.ts
index e99f70f7e0..f997ddf340 100644
--- a/client/src/app/+video-watch/shared/player-widgets/video-transcription.component.ts
+++ b/client/src/app/+video-watch/shared/player-widgets/video-transcription.component.ts
@@ -165,7 +165,7 @@ export class VideoTranscriptionComponent implements OnInit, OnChanges {
}
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
diff --git a/client/src/app/+video-watch/shared/player-widgets/video-watch-playlist.component.ts b/client/src/app/+video-watch/shared/player-widgets/video-watch-playlist.component.ts
index eac62a005f..2aba2113e5 100644
--- a/client/src/app/+video-watch/shared/player-widgets/video-watch-playlist.component.ts
+++ b/client/src/app/+video-watch/shared/player-widgets/video-watch-playlist.component.ts
@@ -253,7 +253,7 @@ export class VideoWatchPlaylistComponent {
this.auth.refreshUserInformation()
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
} else {
this.userService.updateMyAnonymousProfile(details)
diff --git a/client/src/app/+video-watch/shared/recommendations/recommended-videos.component.ts b/client/src/app/+video-watch/shared/recommendations/recommended-videos.component.ts
index 71bc3553ff..74e13af450 100644
--- a/client/src/app/+video-watch/shared/recommendations/recommended-videos.component.ts
+++ b/client/src/app/+video-watch/shared/recommendations/recommended-videos.component.ts
@@ -85,7 +85,7 @@ export class RecommendedVideosComponent implements OnInit, OnChanges, OnDestroy
this.authService.refreshUserInformation()
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
} else {
this.userService.updateMyAnonymousProfile(details)
@@ -101,7 +101,7 @@ export class RecommendedVideosComponent implements OnInit, OnChanges, OnDestroy
this.gotRecommendations.emit(this.videos)
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
}
diff --git a/client/src/app/+video-watch/video-watch.component.ts b/client/src/app/+video-watch/video-watch.component.ts
index d024107ec7..d998e887f1 100644
--- a/client/src/app/+video-watch/video-watch.component.ts
+++ b/client/src/app/+video-watch/video-watch.component.ts
@@ -468,14 +468,22 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
HttpStatusCode.BAD_REQUEST_400,
HttpStatusCode.FORBIDDEN_403,
HttpStatusCode.NOT_FOUND_404
- ])
+ ]).subscribe({
+ next: () => {
+ // empty
+ },
+
+ error: err => this.notifier.handleError(err)
+ })
}
- private handleGlobalError (err: any) {
- const errorMessage: string = typeof err === 'string' ? err : err.message
- if (!errorMessage) return
+ private handleGlobalError (err: Error | string) {
+ if (typeof err === 'string') {
+ this.notifier.error(err)
+ return
+ }
- this.notifier.error(errorMessage)
+ return this.notifier.handleError(err)
}
private handleVideoPasswordError (err: any) {
diff --git a/client/src/app/+videos-publish-manage/+video-publish/import/video-import-torrent.component.ts b/client/src/app/+videos-publish-manage/+video-publish/import/video-import-torrent.component.ts
index e8ec431251..ceeb290081 100644
--- a/client/src/app/+videos-publish-manage/+video-publish/import/video-import-torrent.component.ts
+++ b/client/src/app/+videos-publish-manage/+video-publish/import/video-import-torrent.component.ts
@@ -155,18 +155,20 @@ export class VideoImportTorrentComponent implements OnInit, AfterViewInit, CanCo
},
error: err => {
+ this.isImportingVideo = false
+
this.loadingBar.useRef().complete()
this.firstStepError.emit()
- let message = err.message
const error = err.body as PeerTubeProblemDocument
if (error?.code === ServerErrorCode.INCORRECT_FILES_IN_TORRENT) {
- message = $localize`Torrents with only 1 file are supported.`
+ this.notifier.error($localize`Torrents with only 1 file are supported.`)
+
+ return
}
- this.notifier.error(message)
- this.isImportingVideo = false
+ this.notifier.handleError(err)
}
})
}
diff --git a/client/src/app/+videos-publish-manage/+video-publish/import/video-import-url.component.ts b/client/src/app/+videos-publish-manage/+video-publish/import/video-import-url.component.ts
index 030f28741d..2eb0d800e8 100644
--- a/client/src/app/+videos-publish-manage/+video-publish/import/video-import-url.component.ts
+++ b/client/src/app/+videos-publish-manage/+video-publish/import/video-import-url.component.ts
@@ -1,4 +1,3 @@
-
import { AfterViewInit, Component, OnInit, inject, input, output } from '@angular/core'
import { FormsModule, ReactiveFormsModule } from '@angular/forms'
import { ActivatedRoute, RouterLink } from '@angular/router'
@@ -37,7 +36,7 @@ const debugLogger = debug('peertube:video-publish')
ReactiveFormsModule,
AlertComponent,
VideoManageContainerComponent
-]
+ ]
})
export class VideoImportUrlComponent implements OnInit, AfterViewInit, CanComponentDeactivate {
private authService = inject(AuthService)
@@ -151,7 +150,7 @@ export class VideoImportUrlComponent implements OnInit, AfterViewInit, CanCompon
this.loadingBar.useRef().complete()
this.isImportingVideo = false
this.firstStepError.emit()
- this.notifier.error(err.message)
+ this.notifier.handleError(err)
}
})
}
diff --git a/client/src/app/+videos-publish-manage/+video-publish/live/video-go-live.component.ts b/client/src/app/+videos-publish-manage/+video-publish/live/video-go-live.component.ts
index 9c198be07f..26da892ef1 100644
--- a/client/src/app/+videos-publish-manage/+video-publish/live/video-go-live.component.ts
+++ b/client/src/app/+videos-publish-manage/+video-publish/live/video-go-live.component.ts
@@ -124,18 +124,17 @@ export class VideoGoLiveComponent implements OnInit, AfterViewInit, CanComponent
error: err => {
this.firstStepError.emit()
+ this.isGoingLive = false
- let message = err.message
const error = err.body as PeerTubeProblemDocument
if (error?.code === ServerErrorCode.MAX_INSTANCE_LIVES_LIMIT_REACHED) {
- message = $localize`Cannot create live because this platform has too many created lives`
+ this.notifier.error($localize`Cannot create live because this platform has too many created lives`)
} else if (error?.code === ServerErrorCode.MAX_USER_LIVES_LIMIT_REACHED) {
- message = $localize`Cannot create live because you created too many lives`
+ this.notifier.error($localize`Cannot create live because you created too many lives`)
+ } else {
+ this.notifier.handleError(err)
}
-
- this.notifier.error(message)
- this.isGoingLive = false
}
})
}
diff --git a/client/src/app/+videos-publish-manage/shared-manage/main-info/video-main-info.component.ts b/client/src/app/+videos-publish-manage/shared-manage/main-info/video-main-info.component.ts
index 26a6222a1d..56be65b5d9 100644
--- a/client/src/app/+videos-publish-manage/shared-manage/main-info/video-main-info.component.ts
+++ b/client/src/app/+videos-publish-manage/shared-manage/main-info/video-main-info.component.ts
@@ -497,7 +497,7 @@ export class VideoMainInfoComponent implements OnInit, OnDestroy {
this.router.navigate([ '/my-library/videos' ])
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
diff --git a/client/src/app/+videos-publish-manage/shared-manage/stats/video-stats.component.ts b/client/src/app/+videos-publish-manage/shared-manage/stats/video-stats.component.ts
index ecc2194e4e..9ef1967a46 100644
--- a/client/src/app/+videos-publish-manage/shared-manage/stats/video-stats.component.ts
+++ b/client/src/app/+videos-publish-manage/shared-manage/stats/video-stats.component.ts
@@ -261,7 +261,7 @@ export class VideoStatsComponent implements OnInit {
this.buildOverallStatCard(res)
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
@@ -280,7 +280,7 @@ export class VideoStatsComponent implements OnInit {
this.dateFilters = this.dateFilters.concat(newFilters)
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
@@ -294,7 +294,7 @@ export class VideoStatsComponent implements OnInit {
error: err => {
if (err.status === HttpStatusCode.NOT_FOUND_404) return
- this.notifier.error(err.message)
+ this.notifier.handleError(err)
}
})
}
@@ -412,7 +412,7 @@ export class VideoStatsComponent implements OnInit {
this.chartOptions[this.activeGraphId] = this.buildChartOptions(this.activeGraphId)
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
diff --git a/client/src/app/core/auth/auth.service.ts b/client/src/app/core/auth/auth.service.ts
index e55b56682e..5d275f222d 100644
--- a/client/src/app/core/auth/auth.service.ts
+++ b/client/src/app/core/auth/auth.service.ts
@@ -1,10 +1,10 @@
import { HttpClient, HttpErrorResponse, HttpHeaders, HttpParams } from '@angular/common/http'
-import { Injectable, inject } from '@angular/core'
+import { inject, Injectable } from '@angular/core'
import { Router } from '@angular/router'
import { Hotkey, HotkeysService } from '@app/core'
import { Notifier } from '@app/core/notification/notifier.service'
import { HttpStatusCode, OAuthClientLocal, User, UserLogin, UserRefreshToken, MyUser as UserServerModel } from '@peertube/peertube-models'
-import { logger, OAuthUserTokens, objectToUrlEncoded, peertubeLocalStorage } from '@root-helpers/index'
+import { logger, OAuthUserTokens, objectToUrlEncoded, peertubeLocalStorage, PeerTubeReconnectError } from '@root-helpers/index'
import { Observable, of, ReplaySubject, Subject, throwError } from 'rxjs'
import { catchError, map, mergeMap, share, tap } from 'rxjs/operators'
import { environment } from '../../../environments/environment'
@@ -190,7 +190,11 @@ Ensure you have correctly configured PeerTube (config/ directory), in particular
}
},
- error: err => logger.error(err)
+ error: err => {
+ if (!(err instanceof PeerTubeReconnectError)) {
+ logger.error(err)
+ }
+ }
})
this.user = null
@@ -200,7 +204,7 @@ Ensure you have correctly configured PeerTube (config/ directory), in particular
refreshAccessToken () {
if (this.refreshingTokenObservable) return this.refreshingTokenObservable
- if (!this.getAccessToken()) return throwError(() => new Error($localize`You need to reconnect`))
+ if (!this.getAccessToken()) return throwError(() => new PeerTubeReconnectError($localize`You need to reconnect`, true))
logger.info('Refreshing token...')
@@ -222,13 +226,13 @@ Ensure you have correctly configured PeerTube (config/ directory), in particular
this.refreshingTokenObservable = null
}),
catchError(err => {
- logger.clientError(err)
+ logger.clientError(err.message, err)
this.logout()
this.notifier.info($localize`Your authentication has expired, you need to reconnect.`, undefined, undefined, true)
this.refreshingTokenObservable = null
- return throwError(() => new Error($localize`You need to reconnect`))
+ throw new PeerTubeReconnectError($localize`You need to reconnect`, true)
}),
share()
)
diff --git a/client/src/app/core/notification/notifier.service.ts b/client/src/app/core/notification/notifier.service.ts
index 54e7d69b2e..f0bfe79149 100644
--- a/client/src/app/core/notification/notifier.service.ts
+++ b/client/src/app/core/notification/notifier.service.ts
@@ -1,6 +1,9 @@
-import { MessageService } from 'primeng/api'
+import { HttpErrorResponse } from '@angular/common/http'
import { Injectable, inject } from '@angular/core'
+import { HttpStatusCode } from '@peertube/peertube-models'
+import { PeerTubeHTTPError, PeerTubeReconnectError } from '@root-helpers/errors'
import { logger } from '@root-helpers/logger'
+import { MessageService } from 'primeng/api'
@Injectable()
export class Notifier {
@@ -12,24 +15,47 @@ export class Notifier {
if (!title) title = $localize`Info`
logger.info(`${title}: ${text}`)
- return this.notify('info', text, title, timeout, sticky)
+ return this.notify({ severity: 'info', text, title, timeout, sticky })
}
error (text: string, title?: string, timeout?: number, sticky?: boolean) {
if (!title) title = $localize`Error`
logger.error(`${title}: ${text}`)
- return this.notify('error', text, title, timeout, sticky)
+ return this.notify({ severity: 'error', text, title, timeout, sticky })
}
success (text: string, title?: string, timeout?: number, sticky?: boolean) {
if (!title) title = $localize`Success`
logger.info(`${title}: ${text}`)
- return this.notify('success', text, title, timeout, sticky)
+ return this.notify({ severity: 'success', text, title, timeout, sticky })
+ }
+
+ handleError (err: Error) {
+ if (err instanceof PeerTubeReconnectError && err.alreadyNotified) return
+
+ if (err instanceof PeerTubeHTTPError) {
+ const message = `Backend returned code ${err.status}, errorMessage is: ${err.message}`
+
+ if (err.status === HttpStatusCode.NOT_FOUND_404) logger.clientError(message)
+ else logger.error(message, { url: err.url })
+ } else {
+ logger.error(err.message, err)
+ }
+
+ return this.notify({ severity: 'error', text: err.message, title: $localize`Error` })
}
- private notify (severity: 'success' | 'info' | 'warn' | 'error', text: string, title: string, timeout?: number, sticky?: boolean) {
+ private notify (options: {
+ severity: 'success' | 'info' | 'warn' | 'error'
+ text: string
+ title: string
+ timeout?: number
+ sticky?: boolean
+ }) {
+ const { severity, text, title, timeout, sticky } = options
+
this.messageService.add({
severity,
summary: title,
diff --git a/client/src/app/core/rest/rest-extractor.service.ts b/client/src/app/core/rest/rest-extractor.service.ts
index 2adb43640e..b3d59d78ad 100644
--- a/client/src/app/core/rest/rest-extractor.service.ts
+++ b/client/src/app/core/rest/rest-extractor.service.ts
@@ -1,10 +1,10 @@
-import { throwError as observableThrowError } from 'rxjs'
-import { HttpHeaderResponse } from '@angular/common/http'
+import { HttpErrorResponse, HttpHeaderResponse } from '@angular/common/http'
import { Injectable, LOCALE_ID, inject } from '@angular/core'
import { Router } from '@angular/router'
import { DateFormat, dateToHuman } from '@app/helpers'
import { HttpStatusCode, HttpStatusCodeType, ResultList } from '@peertube/peertube-models'
-import { logger } from '@root-helpers/logger'
+import { PeerTubeHTTPError, PeerTubeReconnectError } from '@root-helpers/errors'
+import { throwError as observableThrowError } from 'rxjs'
@Injectable()
export class RestExtractor {
@@ -70,36 +70,31 @@ export class RestExtractor {
errorObj.body = err.error
}
- return observableThrowError(() => errorObj)
- }
-
- private buildErrorMessage (err: any) {
- if (err.error instanceof Error) {
- // A client-side or network error occurred. Handle it accordingly.
- const errorMessage = err.error.detail || err.error.title
- logger.error('An error occurred:', errorMessage)
-
- return errorMessage
- }
-
- if (typeof err.error === 'string') {
- return err.error
- }
-
- if (err.status !== undefined) {
- // A fetch response
- const errorMessage = this.buildServerErrorMessage(err)
+ return observableThrowError(() => {
+ if (err instanceof PeerTubeReconnectError) {
+ return err
+ }
- const message = `Backend returned code ${err.status}, errorMessage is: ${errorMessage}`
+ if (err.status) {
+ return new PeerTubeHTTPError(errorMessage, {
+ status: err.status,
+ body: errorObj.body,
+ headers: errorObj.headers,
+ url: err.url
+ })
+ }
- if (err.status === HttpStatusCode.NOT_FOUND_404) logger.clientError(message)
- else logger.error(message, { type: err.type, url: err.url })
+ return err
+ })
+ }
- return errorMessage
- }
+ private buildErrorMessage (err: any) {
+ if (err.error instanceof Error) return err.error.detail || err.error.title
+ if (typeof err.error === 'string') return err.error
+ if (err.status !== undefined) return this.buildServerErrorMessage(err)
+ if (typeof err === 'string') return err
- logger.error(err)
- return err
+ return err.message || err.detail || $localize`Unknown error`
}
private buildServerErrorMessage (err: any) {
diff --git a/client/src/app/header/notification-dropdown.component.ts b/client/src/app/header/notification-dropdown.component.ts
index 5ccd9694d7..87137d79f9 100644
--- a/client/src/app/header/notification-dropdown.component.ts
+++ b/client/src/app/header/notification-dropdown.component.ts
@@ -53,7 +53,7 @@ export class NotificationDropdownComponent implements OnInit, OnDestroy {
this.subscribeToNotifications()
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
this.routeSub = this.router.events
diff --git a/client/src/app/modal/account-setup-warning-modal.component.ts b/client/src/app/modal/account-setup-warning-modal.component.ts
index ec350c27b0..5e57df3c58 100644
--- a/client/src/app/modal/account-setup-warning-modal.component.ts
+++ b/client/src/app/modal/account-setup-warning-modal.component.ts
@@ -84,7 +84,7 @@ export class AccountSetupWarningModalComponent implements OnInit {
.subscribe({
next: () => logger.info('We will not open the account setup modal again.'),
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
}
diff --git a/client/src/app/modal/admin-config-wizard/admin-config-wizard-modal.component.ts b/client/src/app/modal/admin-config-wizard/admin-config-wizard-modal.component.ts
index d2ba3552bc..16ab0236f7 100644
--- a/client/src/app/modal/admin-config-wizard/admin-config-wizard-modal.component.ts
+++ b/client/src/app/modal/admin-config-wizard/admin-config-wizard-modal.component.ts
@@ -108,7 +108,7 @@ export class AdminConfigWizardModalComponent implements OnInit {
.subscribe({
next: () => logger.info('We will not open the welcome modal again.'),
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
diff --git a/client/src/app/modal/admin-config-wizard/steps/admin-config-wizard-preview.component.ts b/client/src/app/modal/admin-config-wizard/steps/admin-config-wizard-preview.component.ts
index fcc9d00474..b470b10b41 100644
--- a/client/src/app/modal/admin-config-wizard/steps/admin-config-wizard-preview.component.ts
+++ b/client/src/app/modal/admin-config-wizard/steps/admin-config-wizard-preview.component.ts
@@ -108,7 +108,7 @@ export class AdminConfigWizardPreviewComponent implements OnChanges {
},
error: err => {
- this.notifier.error(err.message)
+ this.notifier.handleError(err)
this.updating = false
}
})
diff --git a/client/src/app/modal/instance-config-warning-modal.component.ts b/client/src/app/modal/instance-config-warning-modal.component.ts
index 2d547d5cab..4756b87725 100644
--- a/client/src/app/modal/instance-config-warning-modal.component.ts
+++ b/client/src/app/modal/instance-config-warning-modal.component.ts
@@ -77,7 +77,7 @@ export class InstanceConfigWarningModalComponent implements OnInit {
.subscribe({
next: () => logger.info('We will not open the instance config warning modal again.'),
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
}
diff --git a/client/src/app/modal/new-feature-info.service.ts b/client/src/app/modal/new-feature-info.service.ts
index b0b940241c..fb972e0266 100644
--- a/client/src/app/modal/new-feature-info.service.ts
+++ b/client/src/app/modal/new-feature-info.service.ts
@@ -41,7 +41,7 @@ export class NewFeatureInfoService {
.subscribe({
next: () => this.auth.refreshUserInformation(),
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
})
})
diff --git a/client/src/app/shared/shared-abuse-list/abuse-list-table.component.ts b/client/src/app/shared/shared-abuse-list/abuse-list-table.component.ts
index cc8e6e4e22..fcf1030d15 100644
--- a/client/src/app/shared/shared-abuse-list/abuse-list-table.component.ts
+++ b/client/src/app/shared/shared-abuse-list/abuse-list-table.component.ts
@@ -190,7 +190,7 @@ export class AbuseListTableComponent implements OnInit, OnDestroy {
this.table().loadData()
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
@@ -199,7 +199,7 @@ export class AbuseListTableComponent implements OnInit, OnDestroy {
.subscribe({
next: () => this.table().loadData(),
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
@@ -397,7 +397,7 @@ export class AbuseListTableComponent implements OnInit, OnDestroy {
this.updateAbuseState(abuse, AbuseState.ACCEPTED)
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
},
@@ -413,7 +413,7 @@ export class AbuseListTableComponent implements OnInit, OnDestroy {
this.updateAbuseState(abuse, AbuseState.ACCEPTED)
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
},
@@ -435,7 +435,7 @@ export class AbuseListTableComponent implements OnInit, OnDestroy {
this.updateAbuseState(abuse, AbuseState.ACCEPTED)
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
}
@@ -470,7 +470,7 @@ export class AbuseListTableComponent implements OnInit, OnDestroy {
this.updateAbuseState(abuse, AbuseState.ACCEPTED)
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
}
@@ -485,7 +485,7 @@ export class AbuseListTableComponent implements OnInit, OnDestroy {
account.mutedByInstance = true
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
@@ -496,7 +496,7 @@ export class AbuseListTableComponent implements OnInit, OnDestroy {
this.notifier.success($localize`${host} muted by your platform.`)
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
diff --git a/client/src/app/shared/shared-abuse-list/abuse-message-modal.component.ts b/client/src/app/shared/shared-abuse-list/abuse-message-modal.component.ts
index 3973d922d4..4899663a03 100644
--- a/client/src/app/shared/shared-abuse-list/abuse-message-modal.component.ts
+++ b/client/src/app/shared/shared-abuse-list/abuse-message-modal.component.ts
@@ -77,8 +77,7 @@ export class AbuseMessageModalComponent extends FormReactive implements OnInit {
error: err => {
this.sendingMessage = false
- logger.error(err)
- this.notifier.error('Sorry but you cannot send this message. Please retry later')
+ this.notifier.handleError(err)
}
})
}
@@ -92,7 +91,7 @@ export class AbuseMessageModalComponent extends FormReactive implements OnInit {
this.abuseMessages = this.abuseMessages.filter(m => m.id !== abuseMessage.id)
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
@@ -129,7 +128,7 @@ export class AbuseMessageModalComponent extends FormReactive implements OnInit {
})
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
}
diff --git a/client/src/app/shared/shared-abuse-list/moderation-comment-modal.component.ts b/client/src/app/shared/shared-abuse-list/moderation-comment-modal.component.ts
index 6cc56cad9a..c16c1cb7cf 100644
--- a/client/src/app/shared/shared-abuse-list/moderation-comment-modal.component.ts
+++ b/client/src/app/shared/shared-abuse-list/moderation-comment-modal.component.ts
@@ -61,7 +61,7 @@ export class ModerationCommentModalComponent extends FormReactive implements OnI
this.hide()
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
}
diff --git a/client/src/app/shared/shared-admin/admin-config.service.ts b/client/src/app/shared/shared-admin/admin-config.service.ts
index e0795caafb..325ec2b096 100644
--- a/client/src/app/shared/shared-admin/admin-config.service.ts
+++ b/client/src/app/shared/shared-admin/admin-config.service.ts
@@ -145,7 +145,7 @@ export class AdminConfigService {
this.notifier.success(success)
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
diff --git a/client/src/app/shared/shared-forms/user-auto-complete.component.ts b/client/src/app/shared/shared-forms/user-auto-complete.component.ts
index 52cdeb54ee..664d2dd755 100644
--- a/client/src/app/shared/shared-forms/user-auto-complete.component.ts
+++ b/client/src/app/shared/shared-forms/user-auto-complete.component.ts
@@ -49,7 +49,7 @@ export class UserAutoCompleteComponent implements ControlValueAccessor {
.subscribe({
next: usernames => this.suggestions = usernames,
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
}
diff --git a/client/src/app/shared/shared-instance/instance-about-accordion.component.ts b/client/src/app/shared/shared-instance/instance-about-accordion.component.ts
index 9e342fb957..033499be93 100644
--- a/client/src/app/shared/shared-instance/instance-about-accordion.component.ts
+++ b/client/src/app/shared/shared-instance/instance-about-accordion.component.ts
@@ -76,7 +76,7 @@ export class InstanceAboutAccordionComponent implements OnInit {
this.init.emit(this)
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
this.pluginPanels = await this.hookService.wrapObject([], this.pluginScope(), this.pluginHook())
diff --git a/client/src/app/shared/shared-main/users/user-notification.service.ts b/client/src/app/shared/shared-main/users/user-notification.service.ts
index 735553ec5c..25ba420682 100644
--- a/client/src/app/shared/shared-main/users/user-notification.service.ts
+++ b/client/src/app/shared/shared-main/users/user-notification.service.ts
@@ -45,7 +45,10 @@ export class UserNotificationService {
countUnreadNotifications () {
return this.listMyNotifications({ pagination: { currentPage: 1, itemsPerPage: 0 }, ignoreLoadingBar: true, unread: true })
- .pipe(map(n => n.total))
+ .pipe(
+ map(n => n.total),
+ catchError(err => this.restExtractor.handleError(err))
+ )
}
markAsRead (notification: UserNotification) {
diff --git a/client/src/app/shared/shared-moderation/report-modals/account-report.component.ts b/client/src/app/shared/shared-moderation/report-modals/account-report.component.ts
index 97a9e82053..67f992f0dc 100644
--- a/client/src/app/shared/shared-moderation/report-modals/account-report.component.ts
+++ b/client/src/app/shared/shared-moderation/report-modals/account-report.component.ts
@@ -93,7 +93,7 @@ export class AccountReportComponent extends FormReactive implements OnInit {
this.hide()
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
diff --git a/client/src/app/shared/shared-moderation/report-modals/comment-report.component.ts b/client/src/app/shared/shared-moderation/report-modals/comment-report.component.ts
index 4975e44397..b19e16bdf0 100644
--- a/client/src/app/shared/shared-moderation/report-modals/comment-report.component.ts
+++ b/client/src/app/shared/shared-moderation/report-modals/comment-report.component.ts
@@ -92,7 +92,7 @@ export class CommentReportComponent extends FormReactive implements OnInit {
this.hide()
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
diff --git a/client/src/app/shared/shared-moderation/report-modals/video-report.component.ts b/client/src/app/shared/shared-moderation/report-modals/video-report.component.ts
index 648780115f..4f608367eb 100644
--- a/client/src/app/shared/shared-moderation/report-modals/video-report.component.ts
+++ b/client/src/app/shared/shared-moderation/report-modals/video-report.component.ts
@@ -106,7 +106,7 @@ export class VideoReportComponent extends FormReactive implements OnInit {
this.hide()
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
diff --git a/client/src/app/shared/shared-moderation/user-ban-modal.component.ts b/client/src/app/shared/shared-moderation/user-ban-modal.component.ts
index 4cb2e6b9d1..dbcd0fa218 100644
--- a/client/src/app/shared/shared-moderation/user-ban-modal.component.ts
+++ b/client/src/app/shared/shared-moderation/user-ban-modal.component.ts
@@ -83,7 +83,7 @@ export class UserBanModalComponent extends FormReactive implements OnInit {
this.hide()
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
diff --git a/client/src/app/shared/shared-moderation/user-moderation-dropdown.component.ts b/client/src/app/shared/shared-moderation/user-moderation-dropdown.component.ts
index 07f1bb1feb..a666124e0c 100644
--- a/client/src/app/shared/shared-moderation/user-moderation-dropdown.component.ts
+++ b/client/src/app/shared/shared-moderation/user-moderation-dropdown.component.ts
@@ -96,7 +96,7 @@ export class UserModerationDropdownComponent implements OnInit, OnChanges {
this.userChanged.emit()
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
@@ -119,7 +119,7 @@ export class UserModerationDropdownComponent implements OnInit, OnChanges {
this.userDeleted.emit()
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
@@ -131,7 +131,7 @@ export class UserModerationDropdownComponent implements OnInit, OnChanges {
this.userChanged.emit()
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
@@ -142,7 +142,7 @@ export class UserModerationDropdownComponent implements OnInit, OnChanges {
this.notifier.success($localize`Verification email sent to ${user.email}`)
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
@@ -156,7 +156,7 @@ export class UserModerationDropdownComponent implements OnInit, OnChanges {
this.userChanged.emit()
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
@@ -170,7 +170,7 @@ export class UserModerationDropdownComponent implements OnInit, OnChanges {
this.userChanged.emit()
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
@@ -184,7 +184,7 @@ export class UserModerationDropdownComponent implements OnInit, OnChanges {
this.userChanged.emit()
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
@@ -198,7 +198,7 @@ export class UserModerationDropdownComponent implements OnInit, OnChanges {
this.userChanged.emit()
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
@@ -212,7 +212,7 @@ export class UserModerationDropdownComponent implements OnInit, OnChanges {
this.userChanged.emit()
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
@@ -226,7 +226,7 @@ export class UserModerationDropdownComponent implements OnInit, OnChanges {
this.userChanged.emit()
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
@@ -240,7 +240,7 @@ export class UserModerationDropdownComponent implements OnInit, OnChanges {
this.userChanged.emit()
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
@@ -254,7 +254,7 @@ export class UserModerationDropdownComponent implements OnInit, OnChanges {
this.userChanged.emit()
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
@@ -269,7 +269,7 @@ export class UserModerationDropdownComponent implements OnInit, OnChanges {
this.notifier.success($localize`Will remove comments of this account (may take several minutes).`)
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
diff --git a/client/src/app/shared/shared-moderation/video-block.component.ts b/client/src/app/shared/shared-moderation/video-block.component.ts
index 0039e2f248..d2a0ddbcd0 100644
--- a/client/src/app/shared/shared-moderation/video-block.component.ts
+++ b/client/src/app/shared/shared-moderation/video-block.component.ts
@@ -100,7 +100,7 @@ export class VideoBlockComponent extends FormReactive implements OnInit {
this.videoBlocked.emit()
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
}
diff --git a/client/src/app/shared/shared-notifications/user-notification-content.component.ts b/client/src/app/shared/shared-notifications/user-notification-content.component.ts
index 117b9ea10f..af4093a99e 100644
--- a/client/src/app/shared/shared-notifications/user-notification-content.component.ts
+++ b/client/src/app/shared/shared-notifications/user-notification-content.component.ts
@@ -85,7 +85,7 @@ export class UserNotificationContentComponent {
this.router.navigate(this.n.url)
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
@@ -100,7 +100,7 @@ export class UserNotificationContentComponent {
this.n.payload.videoChannelCollaborator.state.id = VideoChannelCollaboratorState.REJECTED
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
}
diff --git a/client/src/app/shared/shared-notifications/user-notifications.component.ts b/client/src/app/shared/shared-notifications/user-notifications.component.ts
index 29013a3312..bd594fc260 100644
--- a/client/src/app/shared/shared-notifications/user-notifications.component.ts
+++ b/client/src/app/shared/shared-notifications/user-notifications.component.ts
@@ -83,7 +83,7 @@ export class UserNotificationsComponent implements OnInit {
this.onDataSubject.next(result.data)
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
@@ -106,7 +106,7 @@ export class UserNotificationsComponent implements OnInit {
notification.payload.read = true
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
@@ -119,7 +119,7 @@ export class UserNotificationsComponent implements OnInit {
}
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
diff --git a/client/src/app/shared/shared-tables/table.component.ts b/client/src/app/shared/shared-tables/table.component.ts
index 93313834d6..594bb16610 100644
--- a/client/src/app/shared/shared-tables/table.component.ts
+++ b/client/src/app/shared/shared-tables/table.component.ts
@@ -487,7 +487,7 @@ export class TableComponent<Data, ColumnName = string, QueryParams extends Table
},
error: err => {
- this.notifier.error(err.message)
+ this.notifier.handleError(err)
rej(err)
}
})
diff --git a/client/src/app/shared/shared-user-settings/user-interface-settings.component.ts b/client/src/app/shared/shared-user-settings/user-interface-settings.component.ts
index 4c8a771102..e5a53c0c07 100644
--- a/client/src/app/shared/shared-user-settings/user-interface-settings.component.ts
+++ b/client/src/app/shared/shared-user-settings/user-interface-settings.component.ts
@@ -141,7 +141,7 @@ export class UserInterfaceSettingsComponent implements OnInit, OnDestroy {
if (this.notifyOnUpdate()) this.notifier.success($localize`Interface settings updated.`)
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
return
@@ -154,7 +154,7 @@ export class UserInterfaceSettingsComponent implements OnInit, OnDestroy {
window.location.reload()
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
return
diff --git a/client/src/app/shared/shared-user-settings/user-video-settings.component.ts b/client/src/app/shared/shared-user-settings/user-video-settings.component.ts
index a0ee01d814..d4d62a0515 100644
--- a/client/src/app/shared/shared-user-settings/user-video-settings.component.ts
+++ b/client/src/app/shared/shared-user-settings/user-video-settings.component.ts
@@ -224,7 +224,7 @@ export class UserVideoSettingsComponent implements OnInit, OnDestroy {
if (this.notifyOnUpdate()) this.notifier.success($localize`Video settings updated.`)
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
diff --git a/client/src/app/shared/shared-user-subscription/subscribe-button.component.ts b/client/src/app/shared/shared-user-subscription/subscribe-button.component.ts
index 4ef26d55cb..4aef712e22 100644
--- a/client/src/app/shared/shared-user-subscription/subscribe-button.component.ts
+++ b/client/src/app/shared/shared-user-subscription/subscribe-button.component.ts
@@ -147,7 +147,7 @@ export class SubscribeButtonComponent implements OnChanges {
)
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
@@ -184,7 +184,7 @@ export class SubscribeButtonComponent implements OnChanges {
)
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
@@ -236,7 +236,7 @@ export class SubscribeButtonComponent implements OnChanges {
this.buildClasses()
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
}
diff --git a/client/src/app/shared/shared-users/account-token-sessions.component.ts b/client/src/app/shared/shared-users/account-token-sessions.component.ts
index 1c32215bcc..fa6e478ef4 100644
--- a/client/src/app/shared/shared-users/account-token-sessions.component.ts
+++ b/client/src/app/shared/shared-users/account-token-sessions.component.ts
@@ -42,9 +42,7 @@ export class AccountTokenSessionsComponent implements OnInit {
this.listSessions()
},
- error: err => {
- this.notifier.error(err.message)
- }
+ error: err => this.notifier.handleError(err)
})
}
@@ -65,7 +63,7 @@ export class AccountTokenSessionsComponent implements OnInit {
})
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
}
diff --git a/client/src/app/shared/shared-video-comment/video-comment-list-admin-owner.component.ts b/client/src/app/shared/shared-video-comment/video-comment-list-admin-owner.component.ts
index 72b799e676..c427f13af8 100644
--- a/client/src/app/shared/shared-video-comment/video-comment-list-admin-owner.component.ts
+++ b/client/src/app/shared/shared-video-comment/video-comment-list-admin-owner.component.ts
@@ -245,7 +245,7 @@ export class VideoCommentListAdminOwnerComponent implements OnInit, OnDestroy {
this.table().loadData()
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
@@ -265,7 +265,7 @@ export class VideoCommentListAdminOwnerComponent implements OnInit, OnDestroy {
this.table().loadData()
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
@@ -274,7 +274,7 @@ export class VideoCommentListAdminOwnerComponent implements OnInit, OnDestroy {
.subscribe({
next: () => this.table().loadData(),
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
@@ -296,7 +296,7 @@ export class VideoCommentListAdminOwnerComponent implements OnInit, OnDestroy {
this.notifier.success($localize`Comments of ${options.accountName} will be deleted in a few minutes`)
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
}
diff --git a/client/src/app/shared/shared-video-miniature/download/video-download.component.ts b/client/src/app/shared/shared-video-miniature/download/video-download.component.ts
index ad87d6e3f8..78111aabb5 100644
--- a/client/src/app/shared/shared-video-miniature/download/video-download.component.ts
+++ b/client/src/app/shared/shared-video-miniature/download/video-download.component.ts
@@ -5,6 +5,7 @@ import { AuthService, HooksService } from '@app/core'
import { GlobalIconComponent } from '@app/shared/shared-icons/global-icon.component'
import { NgbModal, NgbModalRef } from '@ng-bootstrap/ng-bootstrap'
import { VideoCaption, VideoSource } from '@peertube/peertube-models'
+import { logger } from '@root-helpers/logger'
import { videoRequiresFileToken } from '@root-helpers/video'
import { of } from 'rxjs'
import { catchError } from 'rxjs/operators'
@@ -101,7 +102,7 @@ export class VideoDownloadComponent {
return this.videoService.getSource(this.video.id)
.pipe(catchError(err => {
- console.error('Cannot get source file', err)
+ logger.error('Cannot get source file', err)
return of(undefined)
}))
diff --git a/client/src/app/shared/shared-video-miniature/video-actions-dropdown.component.ts b/client/src/app/shared/shared-video-miniature/video-actions-dropdown.component.ts
index 1dd800e2cb..10b351f873 100644
--- a/client/src/app/shared/shared-video-miniature/video-actions-dropdown.component.ts
+++ b/client/src/app/shared/shared-video-miniature/video-actions-dropdown.component.ts
@@ -291,7 +291,7 @@ export class VideoActionsDropdownComponent implements OnChanges {
this.videoUnblocked.emit()
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
@@ -314,7 +314,7 @@ export class VideoActionsDropdownComponent implements OnChanges {
this.videoRemoved.emit()
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
@@ -326,7 +326,7 @@ export class VideoActionsDropdownComponent implements OnChanges {
this.notifier.success(message)
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
@@ -341,7 +341,7 @@ export class VideoActionsDropdownComponent implements OnChanges {
this.videoAccountMuted.emit()
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
@@ -355,7 +355,7 @@ export class VideoActionsDropdownComponent implements OnChanges {
this.notifier.success($localize`Account ${params.nameWithHost} unmuted.`)
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
@@ -372,7 +372,7 @@ export class VideoActionsDropdownComponent implements OnChanges {
this.videoFilesRemoved.emit()
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
@@ -384,7 +384,7 @@ export class VideoActionsDropdownComponent implements OnChanges {
this.transcodingCreated.emit()
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
@@ -397,7 +397,7 @@ export class VideoActionsDropdownComponent implements OnChanges {
else if (result.alreadyHasCaptions) this.notifier.info($localize`This video already has captions.`)
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
diff --git a/client/src/app/shared/shared-video-miniature/videos-list.component.ts b/client/src/app/shared/shared-video-miniature/videos-list.component.ts
index 7b47727e6f..bea737ee65 100644
--- a/client/src/app/shared/shared-video-miniature/videos-list.component.ts
+++ b/client/src/app/shared/shared-video-miniature/videos-list.component.ts
@@ -346,7 +346,7 @@ export class VideosListComponent implements OnInit, OnDestroy {
},
error: err => {
- const message = $localize`Cannot load more videos. Try again later.`
+ const message = $localize`Cannot load more videos. Please try again later.`
logger.error(message, err)
this.notifier.error(message)
diff --git a/client/src/app/shared/shared-video-miniature/videos-selection.component.ts b/client/src/app/shared/shared-video-miniature/videos-selection.component.ts
index 2b787f548d..6382558f1a 100644
--- a/client/src/app/shared/shared-video-miniature/videos-selection.component.ts
+++ b/client/src/app/shared/shared-video-miniature/videos-selection.component.ts
@@ -109,7 +109,7 @@ export class VideosSelectionComponent implements AfterContentInit {
},
error: err => {
- const message = $localize`Cannot load more videos. Try again later.`
+ const message = $localize`Cannot load more videos. Please try again later.`
logger.error(message, err)
this.notifier.error(message)
diff --git a/client/src/app/shared/shared-video-playlist/video-add-to-playlist.component.ts b/client/src/app/shared/shared-video-playlist/video-add-to-playlist.component.ts
index ec0b97b299..d5aec58c4f 100644
--- a/client/src/app/shared/shared-video-playlist/video-add-to-playlist.component.ts
+++ b/client/src/app/shared/shared-video-playlist/video-add-to-playlist.component.ts
@@ -225,7 +225,7 @@ export class VideoAddToPlaylistComponent extends FormReactive implements OnInit,
this.cd.markForCheck()
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
@@ -296,7 +296,7 @@ export class VideoAddToPlaylistComponent extends FormReactive implements OnInit,
this.videoExistsInPlaylistChange.emit()
},
- error: err => this.notifier.error(err.message),
+ error: err => this.notifier.handleError(err),
complete: () => this.cd.markForCheck()
})
@@ -330,7 +330,7 @@ export class VideoAddToPlaylistComponent extends FormReactive implements OnInit,
this.videoExistsInPlaylistChange.emit()
},
- error: err => this.notifier.error(err.message),
+ error: err => this.notifier.handleError(err),
complete: () => this.cd.markForCheck()
})
@@ -412,7 +412,7 @@ export class VideoAddToPlaylistComponent extends FormReactive implements OnInit,
this.pendingAddId = undefined
this.cd.markForCheck()
- this.notifier.error(err.message)
+ this.notifier.handleError(err)
},
complete: () => {
diff --git a/client/src/app/shared/shared-video-playlist/video-playlist-element-miniature.component.ts b/client/src/app/shared/shared-video-playlist/video-playlist-element-miniature.component.ts
index 506d602972..3781d4177e 100644
--- a/client/src/app/shared/shared-video-playlist/video-playlist-element-miniature.component.ts
+++ b/client/src/app/shared/shared-video-playlist/video-playlist-element-miniature.component.ts
@@ -148,7 +148,7 @@ export class VideoPlaylistElementMiniatureComponent implements OnInit {
this.elementRemoved.emit(playlistElement)
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
this.moreDropdown().close()
@@ -171,7 +171,7 @@ export class VideoPlaylistElementMiniatureComponent implements OnInit {
this.cdr.detectChanges()
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
this.moreDropdown().close()
diff --git a/client/src/app/shared/shared-watched-words/watched-words-list-admin-owner.component.ts b/client/src/app/shared/shared-watched-words/watched-words-list-admin-owner.component.ts
index 473bb01c64..2bee3635e1 100644
--- a/client/src/app/shared/shared-watched-words/watched-words-list-admin-owner.component.ts
+++ b/client/src/app/shared/shared-watched-words/watched-words-list-admin-owner.component.ts
@@ -131,7 +131,7 @@ export class WatchedWordsListAdminOwnerComponent {
this.table().loadData()
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
}
}
diff --git a/client/src/app/shared/shared-watched-words/watched-words-list-save-modal.component.ts b/client/src/app/shared/shared-watched-words/watched-words-list-save-modal.component.ts
index 05042d9dfd..1a795d1c0f 100644
--- a/client/src/app/shared/shared-watched-words/watched-words-list-save-modal.component.ts
+++ b/client/src/app/shared/shared-watched-words/watched-words-list-save-modal.component.ts
@@ -81,7 +81,7 @@ export class WatchedWordsListSaveModalComponent extends FormReactive implements
this.listAddedOrUpdated.emit()
},
- error: err => this.notifier.error(err.message)
+ error: err => this.notifier.handleError(err)
})
this.hide()
diff --git a/client/src/root-helpers/errors.ts b/client/src/root-helpers/errors.ts
new file mode 100644
index 0000000000..729149180c
--- /dev/null
+++ b/client/src/root-helpers/errors.ts
@@ -0,0 +1,36 @@
+export class PeerTubeReconnectError extends Error {
+ alreadyNotified: boolean
+
+ constructor (message: string, alreadyNotified: boolean) {
+ super(message)
+
+ this.name = 'PeerTubeReconnectError'
+ this.alreadyNotified = alreadyNotified
+
+ Object.setPrototypeOf(this, PeerTubeReconnectError.prototype)
+ }
+}
+
+export class PeerTubeHTTPError extends Error {
+ status: number
+ body: any
+ headers: any
+ url: string
+
+ constructor (message: string, meta: {
+ status: number
+ body: any
+ headers: any
+ url: string
+ }) {
+ super(message)
+
+ this.name = 'HTTPError'
+ this.status = meta.status
+ this.body = meta.body
+ this.headers = meta.headers
+ this.url = meta.url
+
+ Object.setPrototypeOf(this, PeerTubeHTTPError.prototype)
+ }
+}
diff --git a/client/src/root-helpers/index.ts b/client/src/root-helpers/index.ts
index b4479f0ecd..d22408899a 100644
--- a/client/src/root-helpers/index.ts
+++ b/client/src/root-helpers/index.ts
@@ -1,5 +1,6 @@
export * from './users'
export * from './bytes'
+export * from './errors'
export * from './images'
export * from './local-storage-utils'
export * from './logger'
diff --git a/server/core/controllers/api/users/token.ts b/server/core/controllers/api/users/token.ts
index 1952092a8f..6f7fa3616c 100644
--- a/server/core/controllers/api/users/token.ts
+++ b/server/core/controllers/api/users/token.ts
@@ -1,3 +1,4 @@
+import { InvalidGrantError } from '@node-oauth/oauth2-server'
import { ResultList, ScopedToken, TokenSession } from '@peertube/peertube-models'
import { buildUUID } from '@peertube/peertube-node-utils'
import { logger } from '@server/helpers/logger.js'
@@ -119,6 +120,8 @@ async function handleToken (req: express.Request, res: express.Response, next: e
if (err instanceof MissingTwoFactorError) {
res.set(OTP.HEADER_NAME, OTP.HEADER_REQUIRED_VALUE)
logger.debug('Missing two factor error', { err })
+ } else if (err instanceof InvalidGrantError) {
+ logger.debug('Invalid grant', { err })
} else {
logger.warn('Login error', { err })
}