Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Type fixes: assume catch variables are unknown

Alexander Brandon Coles8fad1a0fa2f6
diff --git a/frontend/src/app/core/setup/globals/global-listeners.ts b/frontend/src/app/core/setup/globals/global-listeners.ts
index 5054d450d7f..044f2fa4037 100644
--- a/frontend/src/app/core/setup/globals/global-listeners.ts
+++ b/frontend/src/app/core/setup/globals/global-listeners.ts
@@ -91,7 +91,9 @@ export function initializeGlobalListeners():void {
// This is very likely an invalid selector such as a Google Analytics tag.
// We can safely ignore this and just not scroll in this case.
// Still log the error so one can confirm the reason there is no scrolling.
- console.log(`Could not scroll to given location hash: ${hash} ( ${e.message})`);
+ if (e instanceof Error) {
+ console.log(`Could not scroll to given location hash: ${hash} ( ${e.message})`);
+ }
}
}
diff --git a/frontend/src/app/features/boards/board/board-list/board-lists.service.ts b/frontend/src/app/features/boards/board/board-list/board-lists.service.ts
index 7248460ba19..9d9d6981f91 100644
--- a/frontend/src/app/features/boards/board/board-list/board-lists.service.ts
+++ b/frontend/src/app/features/boards/board/board-list/board-lists.service.ts
@@ -14,6 +14,7 @@ import {
Observable,
switchMap,
} from 'rxjs';
+import { HttpErrorResponse } from '@angular/common/http';
@Injectable({ providedIn: 'root' })
export class BoardListsService {
@@ -94,8 +95,10 @@ export class BoardListsService {
const resource = this.halResourceService.createHalResourceOfClass(GridWidgetResource, source);
board.addQuery(resource);
} catch (e) {
- this.toastService.addError(e);
- console.error(e);
+ if (e instanceof HttpErrorResponse) {
+ this.toastService.addError(e);
+ console.error(e);
+ }
}
return board;
}
diff --git a/frontend/src/app/shared/components/editor/components/ckeditor/op-ckeditor.component.ts b/frontend/src/app/shared/components/editor/components/ckeditor/op-ckeditor.component.ts
index ebc126ff2ff..8e8c89f0f8f 100644
--- a/frontend/src/app/shared/components/editor/components/ckeditor/op-ckeditor.component.ts
+++ b/frontend/src/app/shared/components/editor/components/ckeditor/op-ckeditor.component.ts
@@ -173,16 +173,17 @@ export class OpCkeditorComponent extends UntilDestroyedMixin implements OnInit,
return this.getRawData();
} catch (e) {
- console.error(`Failed to save CKEditor content: ${e}.`);
+ if (e instanceof Error) {
+ console.error(`Failed to save CKEditor content: ${e.message}.`);
- const error = this.I18n.t(
- 'js.editor.error_saving_failed',
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-call
- { error: e.toString() || this.I18n.t('js.error.internal') },
- );
+ const error = this.I18n.t(
+ 'js.editor.error_saving_failed',
+ { error: e.message },
+ );
- if (notificationOnError) {
- this.Notifications.addError(error);
+ if (notificationOnError) {
+ this.Notifications.addError(error);
+ }
}
return this._content;
@@ -203,14 +204,14 @@ export class OpCkeditorComponent extends UntilDestroyedMixin implements OnInit,
ngOnInit() {
try {
this.initializeEditor();
- } catch (error:unknown) {
+ } catch (e) {
// We will run into this error if, among others, the browser does not fully support
// CKEditor's requirements on ES6.
-
- const message = (error as Error).toString();
- console.error('Failed to setup CKEditor instance: %O', error);
- this.error = message;
- this.initializationFailed.emit(message);
+ console.error('Failed to setup CKEditor instance: %O', e);
+ if (e instanceof Error) {
+ this.error = e.message;
+ this.initializationFailed.emit(e.message);
+ }
}
}
diff --git a/frontend/src/stimulus/controllers/dynamic/two-factor-authentication.controller.ts b/frontend/src/stimulus/controllers/dynamic/two-factor-authentication.controller.ts
index 2588e293800..681997ad75c 100644
--- a/frontend/src/stimulus/controllers/dynamic/two-factor-authentication.controller.ts
+++ b/frontend/src/stimulus/controllers/dynamic/two-factor-authentication.controller.ts
@@ -68,7 +68,9 @@ export default class TwoFactorAuthenticationController extends Controller {
return true;
} catch (error) {
- this.displayError(error);
+ if (error instanceof DOMException) {
+ this.displayError(error);
+ }
return false;
}
}
@@ -102,7 +104,9 @@ export default class TwoFactorAuthenticationController extends Controller {
return true;
} catch (error) {
- this.displayError(error);
+ if (error instanceof DOMException) {
+ this.displayError(error);
+ }
return false;
}
}