Skip to content

Sync-in · Sovereign platform for file storage, sharing, synchronization, and collaboration.

refactor(frontend): simplify promise error handling with .catch(console.error)

johaven822c045c31b0
diff --git a/frontend/scripts/build-assets.mjs b/frontend/scripts/build-assets.mjs
index 9dd639b2..673dd3bc 100644
--- a/frontend/scripts/build-assets.mjs
+++ b/frontend/scripts/build-assets.mjs
@@ -9,6 +9,6 @@ import { checkPdfjs } from './pdfjs.mjs'
console.log('build assets ...')
if (process.env.NODE_ENV !== 'development') {
- checkPdfjs().catch((e) => console.error(e))
+ checkPdfjs().catch(console.error)
}
-checkCodeMirror().catch((e) => console.error(e))
+checkCodeMirror().catch(console.error)
diff --git a/frontend/src/app/applications/admin/admin.service.ts b/frontend/src/app/applications/admin/admin.service.ts
index 32e4f65d..d368895f 100644
--- a/frontend/src/app/applications/admin/admin.service.ts
+++ b/frontend/src/app/applications/admin/admin.service.ts
@@ -5,7 +5,7 @@
*/
import { HttpClient } from '@angular/common/http'
-import { Injectable, inject } from '@angular/core'
+import { inject, Injectable } from '@angular/core'
import { Router } from '@angular/router'
import {
ADMIN_USERS_ROUTE,
@@ -143,6 +143,6 @@ export class AdminService {
initImpersonateUser(r: LoginResponseDto) {
this.authService.initUserFromResponse(r, true)
- this.router.navigate([USER_PATH.BASE, USER_PATH.ACCOUNT]).catch((e: Error) => console.error(e))
+ this.router.navigate([USER_PATH.BASE, USER_PATH.ACCOUNT]).catch(console.error)
}
}
diff --git a/frontend/src/app/applications/admin/components/admin-groups.component.ts b/frontend/src/app/applications/admin/components/admin-groups.component.ts
index 1f58ce79..cc60bcb7 100644
--- a/frontend/src/app/applications/admin/components/admin-groups.component.ts
+++ b/frontend/src/app/applications/admin/components/admin-groups.component.ts
@@ -6,7 +6,7 @@
import { KeyValuePipe } from '@angular/common'
import { HttpErrorResponse } from '@angular/common/http'
-import { Component, ElementRef, ViewChild, inject } from '@angular/core'
+import { Component, ElementRef, inject, ViewChild } from '@angular/core'
import { FormsModule } from '@angular/forms'
import { ActivatedRoute, Data, Router, UrlSegment } from '@angular/router'
import { FaIconComponent } from '@fortawesome/angular-fontawesome'
@@ -203,7 +203,7 @@ export class AdminGroupsComponent {
onPersonalGroupsView(state: boolean) {
this.personalGroupsView = state
- this.router.navigate([ADMIN_PATH.BASE, state ? ADMIN_PATH.PGROUPS : ADMIN_PATH.GROUPS]).catch((e: Error) => console.error(e))
+ this.router.navigate([ADMIN_PATH.BASE, state ? ADMIN_PATH.PGROUPS : ADMIN_PATH.GROUPS]).catch(console.error)
}
refresh() {
@@ -235,7 +235,7 @@ export class AdminGroupsComponent {
browse(m: MemberModel) {
if (m.isGroup) {
- this.router.navigate([m.name], { relativeTo: this.activatedRoute }).catch((e: Error) => console.error(e))
+ this.router.navigate([m.name], { relativeTo: this.activatedRoute }).catch(console.error)
}
}
@@ -304,7 +304,7 @@ export class AdminGroupsComponent {
} else {
this.router
.navigate([`${ADMIN_PATH.BASE}/${ADMIN_PATH.GROUPS}`, g.parent?.id ? g.parent.name : ''], { queryParams: { select: g.name } })
- .catch((e: Error) => console.error(e))
+ .catch(console.error)
}
}
})
@@ -363,7 +363,7 @@ export class AdminGroupsComponent {
} else {
this.router
.navigate([`${ADMIN_PATH.BASE}/${ADMIN_PATH.GROUPS}`, g.parent?.id ? g.parent.name : ''], { queryParams: { select: g.name } })
- .catch((e: Error) => console.error(e))
+ .catch(console.error)
}
}
})
diff --git a/frontend/src/app/applications/admin/components/admin-users.component.ts b/frontend/src/app/applications/admin/components/admin-users.component.ts
index 44610a6a..ba786e34 100644
--- a/frontend/src/app/applications/admin/components/admin-users.component.ts
+++ b/frontend/src/app/applications/admin/components/admin-users.component.ts
@@ -6,7 +6,7 @@
import { KeyValuePipe } from '@angular/common'
import { HttpErrorResponse } from '@angular/common/http'
-import { Component, ElementRef, ViewChild, inject } from '@angular/core'
+import { Component, ElementRef, inject, ViewChild } from '@angular/core'
import { FormsModule } from '@angular/forms'
import { ActivatedRoute, Data, Router } from '@angular/router'
import { FaIconComponent } from '@fortawesome/angular-fontawesome'
@@ -214,7 +214,7 @@ export class AdminUsersComponent {
onGuestsView(state: boolean) {
this.guestsView = state
- this.router.navigate([ADMIN_PATH.BASE, state ? ADMIN_PATH.GUESTS : ADMIN_PATH.USERS]).catch((e: Error) => console.error(e))
+ this.router.navigate([ADMIN_PATH.BASE, state ? ADMIN_PATH.GUESTS : ADMIN_PATH.USERS]).catch(console.error)
}
onContextMenu(ev: any) {
diff --git a/frontend/src/app/applications/files/components/sidebar/files-selection.component.ts b/frontend/src/app/applications/files/components/sidebar/files-selection.component.ts
index 397d9375..0cc8efa7 100755
--- a/frontend/src/app/applications/files/components/sidebar/files-selection.component.ts
+++ b/frontend/src/app/applications/files/components/sidebar/files-selection.component.ts
@@ -4,7 +4,7 @@
* See the LICENSE file for licensing details
*/
-import { ChangeDetectionStrategy, Component, computed, input, InputSignal, Signal, inject } from '@angular/core'
+import { ChangeDetectionStrategy, Component, computed, inject, input, InputSignal, Signal } from '@angular/core'
import { Router } from '@angular/router'
import { FaIconComponent } from '@fortawesome/angular-fontawesome'
import { faArrowsAlt, faClipboardCheck } from '@fortawesome/free-solid-svg-icons'
@@ -61,12 +61,12 @@ export class FilesSelectionComponent {
this.layout.toggleRSideBar(false)
this.router
.navigate([share.type === 0 ? SPACES_PATH.SHARED : SPACES_PATH.LINKS], { queryParams: { select: share.name } })
- .catch((e: Error) => console.error(e))
+ .catch(console.error)
}
goToSpace(space: { alias: string; name: string }) {
this.layout.toggleRSideBar(false)
- this.router.navigate([SPACES_PATH.SPACES], { queryParams: { select: space.name } }).catch((e: Error) => console.error(e))
+ this.router.navigate([SPACES_PATH.SPACES], { queryParams: { select: space.name } }).catch(console.error)
}
goToComments() {
@@ -87,6 +87,6 @@ export class FilesSelectionComponent {
pathId: sync.id
}
})
- .catch((e: Error) => console.error(e))
+ .catch(console.error)
}
}
diff --git a/frontend/src/app/applications/files/components/sidebar/files-tasks.component.ts b/frontend/src/app/applications/files/components/sidebar/files-tasks.component.ts
index 1a698d61..408a32a1 100644
--- a/frontend/src/app/applications/files/components/sidebar/files-tasks.component.ts
+++ b/frontend/src/app/applications/files/components/sidebar/files-tasks.component.ts
@@ -4,7 +4,7 @@
* See the LICENSE file for licensing details
*/
-import { Component, OnDestroy, inject } from '@angular/core'
+import { Component, inject, OnDestroy } from '@angular/core'
import { Router } from '@angular/router'
import { FaIconComponent } from '@fortawesome/angular-fontawesome'
import { IconDefinition } from '@fortawesome/fontawesome-svg-core'
@@ -101,7 +101,7 @@ export class FilesTasksComponent implements OnDestroy {
return
}
}
- this.router.navigate([`${SPACES_PATH.SPACES}/${task.path}`], { queryParams: { select: task.name } }).catch((e: Error) => console.error(e))
+ this.router.navigate([`${SPACES_PATH.SPACES}/${task.path}`], { queryParams: { select: task.name } }).catch(console.error)
}
}
}
diff --git a/frontend/src/app/applications/files/components/sidebar/files-tree.component.ts b/frontend/src/app/applications/files/components/sidebar/files-tree.component.ts
index fdde68ea..b6ce2ad1 100644
--- a/frontend/src/app/applications/files/components/sidebar/files-tree.component.ts
+++ b/frontend/src/app/applications/files/components/sidebar/files-tree.component.ts
@@ -5,7 +5,7 @@
*/
import { IActionMapping, ITreeOptions, TREE_ACTIONS, TreeModel, TreeModule, TreeNode } from '@ali-hm/angular-tree-component'
-import { Component, EventEmitter, Input, OnDestroy, OnInit, Output, ViewChild, inject } from '@angular/core'
+import { Component, EventEmitter, inject, Input, OnDestroy, OnInit, Output, ViewChild } from '@angular/core'
import { toObservable } from '@angular/core/rxjs-interop'
import { Router } from '@angular/router'
import { FaIconComponent } from '@fortawesome/angular-fontawesome'
@@ -291,7 +291,7 @@ export class FilesTreeComponent implements OnInit, OnDestroy {
if (urlSegments[0] !== SPACES_PATH.SPACES) {
urlSegments.unshift(SPACES_PATH.SPACES)
}
- this.router.navigate(urlSegments).catch((e: Error) => console.error(e))
+ this.router.navigate(urlSegments).catch(console.error)
}
}
diff --git a/frontend/src/app/applications/files/components/widgets/files-recents-widget.component.ts b/frontend/src/app/applications/files/components/widgets/files-recents-widget.component.ts
index efdb3c54..18958299 100644
--- a/frontend/src/app/applications/files/components/widgets/files-recents-widget.component.ts
+++ b/frontend/src/app/applications/files/components/widgets/files-recents-widget.component.ts
@@ -4,7 +4,7 @@
* See the LICENSE file for licensing details
*/
-import { Component, computed, Signal, inject } from '@angular/core'
+import { Component, computed, inject, Signal } from '@angular/core'
import { Router } from '@angular/router'
import { FaIconComponent } from '@fortawesome/angular-fontawesome'
import { faFileLines } from '@fortawesome/free-regular-svg-icons'
@@ -51,6 +51,6 @@ export class FilesRecentsWidgetComponent {
}
goToFile(f: FileRecentModel) {
- this.router.navigate([SPACES_PATH.SPACES, ...f.path.split('/')], { queryParams: { select: f.name } }).catch((e: Error) => console.error(e))
+ this.router.navigate([SPACES_PATH.SPACES, ...f.path.split('/')], { queryParams: { select: f.name } }).catch(console.error)
}
}
diff --git a/frontend/src/app/applications/files/services/files-upload.service.ts b/frontend/src/app/applications/files/services/files-upload.service.ts
index b1cf93ee..d5045a06 100644
--- a/frontend/src/app/applications/files/services/files-upload.service.ts
+++ b/frontend/src/app/applications/files/services/files-upload.service.ts
@@ -5,7 +5,7 @@
*/
import { HttpClient, HttpEventType, HttpUploadProgressEvent } from '@angular/common/http'
-import { Injectable, inject } from '@angular/core'
+import { inject, Injectable } from '@angular/core'
import { API_FILES_OPERATION_UPLOAD } from '@sync-in-server/backend/src/applications/files/constants/routes'
import { FileTask, FileTaskStatus } from '@sync-in-server/backend/src/applications/files/models/file-task'
import { lastValueFrom, Observable } from 'rxjs'
@@ -60,7 +60,7 @@ export class FilesUploadService {
if (ev.dataTransfer.items && ev.dataTransfer.items[0]?.webkitGetAsEntry) {
this.webkitReadDataTransfer(ev)
} else {
- this.addFiles(ev.dataTransfer.files).catch((e: Error) => console.error(e))
+ this.addFiles(ev.dataTransfer.files).catch(console.error)
}
}
@@ -120,7 +120,7 @@ export class FilesUploadService {
}
const decrement = () => {
if (--queue == 0) {
- this.addFiles(files).catch((e: Error) => console.error(e))
+ this.addFiles(files).catch(console.error)
}
}
diff --git a/frontend/src/app/applications/links/services/links.service.ts b/frontend/src/app/applications/links/services/links.service.ts
index eff0dee1..d5c077b5 100644
--- a/frontend/src/app/applications/links/services/links.service.ts
+++ b/frontend/src/app/applications/links/services/links.service.ts
@@ -5,7 +5,7 @@
*/
import { HttpClient, HttpErrorResponse } from '@angular/common/http'
-import { Injectable, inject } from '@angular/core'
+import { inject, Injectable } from '@angular/core'
import { Router } from '@angular/router'
import { LINK_ERROR, LINK_TYPE } from '@sync-in-server/backend/src/applications/links/constants/links'
import {
@@ -77,9 +77,9 @@ export class LinksService {
}
if (r.error) {
if (r.error === LINK_ERROR.UNAUTHORIZED) {
- this.router.navigate([`${LINKS_PATH.LINK}/${uuid}/${LINKS_PATH.AUTH}`]).catch((e: Error) => console.error(e))
+ this.router.navigate([`${LINKS_PATH.LINK}/${uuid}/${LINKS_PATH.AUTH}`]).catch(console.error)
} else {
- this.router.navigate([`${LINKS_PATH.LINK}/${uuid}/${r.error}`]).catch((e: Error) => console.error(e))
+ this.router.navigate([`${LINKS_PATH.LINK}/${uuid}/${r.error}`]).catch(console.error)
}
}
return false
@@ -96,9 +96,9 @@ export class LinksService {
this.http.get<LoginResponseDto>(`${API_PUBLIC_LINK_ACCESS}/${uuid}`).subscribe((r) => {
this.authService.initUserFromResponse(r)
if (link.space) {
- this.router.navigate([SPACES_PATH.SPACES], { queryParams: { select: link.space.name } }).catch((e: Error) => console.error(e))
+ this.router.navigate([SPACES_PATH.SPACES], { queryParams: { select: link.space.name } }).catch(console.error)
} else {
- this.router.navigate([SPACES_PATH.SPACES_SHARES], { queryParams: { select: link.share.name } }).catch((e: Error) => console.error(e))
+ this.router.navigate([SPACES_PATH.SPACES_SHARES], { queryParams: { select: link.share.name } }).catch(console.error)
}
})
} else {
@@ -110,14 +110,14 @@ export class LinksService {
return this.http.post<LoginResponseDto>(`${API_PUBLIC_LINK_AUTH}/${uuid}`, { password } as UserPasswordDto).pipe(
map((r: LoginResponseDto) => {
this.authService.initUserFromResponse(r)
- this.router.navigate([`${LINKS_PATH.LINK}/${uuid}`]).catch((e: Error) => console.error(e))
+ this.router.navigate([`${LINKS_PATH.LINK}/${uuid}`]).catch(console.error)
return true
}),
catchError((e) => {
if (e.error.message === LINK_ERROR.UNAUTHORIZED) {
this.layout.sendNotification('warning', 'Link', 'Bad password')
} else {
- this.router.navigate([`${LINKS_PATH.LINK}/${uuid}/${e.error.message}`]).catch((e: Error) => console.error(e))
+ this.router.navigate([`${LINKS_PATH.LINK}/${uuid}/${e.error.message}`]).catch(console.error)
}
return of(false)
})
diff --git a/frontend/src/app/applications/notifications/components/sidebar/notifications.component.ts b/frontend/src/app/applications/notifications/components/sidebar/notifications.component.ts
index 907a1d10..7c737159 100644
--- a/frontend/src/app/applications/notifications/components/sidebar/notifications.component.ts
+++ b/frontend/src/app/applications/notifications/components/sidebar/notifications.component.ts
@@ -5,7 +5,7 @@
*/
import { HttpErrorResponse } from '@angular/common/http'
-import { AfterViewInit, Component, effect, ElementRef, QueryList, ViewChildren, inject } from '@angular/core'
+import { AfterViewInit, Component, effect, ElementRef, inject, QueryList, ViewChildren } from '@angular/core'
import { Router } from '@angular/router'
import { FaIconComponent } from '@fortawesome/angular-fontawesome'
import { faCheck, faCircleInfo, faMagnifyingGlass, faTimes, faTrashAlt } from '@fortawesome/free-solid-svg-icons'
@@ -116,6 +116,6 @@ export class NotificationsComponent implements AfterViewInit {
const element = n.content.app === NOTIFICATION_APP.SYNC ? n.content.element.split('/').at(-1) : n.content.element
this.router
.navigate([SPACES_PATH.SPACES, ...n.content.url.split('/')], { queryParams: { select: element } })
- .catch((e: Error) => console.error(e))
+ .catch(console.error)
}
}
diff --git a/frontend/src/app/applications/search/components/search.component.ts b/frontend/src/app/applications/search/components/search.component.ts
index 72128901..d6f88818 100644
--- a/frontend/src/app/applications/search/components/search.component.ts
+++ b/frontend/src/app/applications/search/components/search.component.ts
@@ -5,7 +5,7 @@
*/
import { HttpErrorResponse } from '@angular/common/http'
-import { Component, computed, Signal, ViewChild, inject } from '@angular/core'
+import { Component, computed, inject, Signal, ViewChild } from '@angular/core'
import { FormsModule } from '@angular/forms'
import { Router } from '@angular/router'
import { FaIconComponent } from '@fortawesome/angular-fontawesome'
@@ -95,6 +95,6 @@ export class SearchComponent {
}
goTo(f: FileContentModel) {
- this.router.navigate([SPACES_PATH.SPACES, ...f.path.split('/')], { queryParams: { select: f.name } }).catch((e: Error) => console.error(e))
+ this.router.navigate([SPACES_PATH.SPACES, ...f.path.split('/')], { queryParams: { select: f.name } }).catch(console.error)
}
}
diff --git a/frontend/src/app/applications/shares/components/shared.component.ts b/frontend/src/app/applications/shares/components/shared.component.ts
index f698d23c..cb13ca31 100644
--- a/frontend/src/app/applications/shares/components/shared.component.ts
+++ b/frontend/src/app/applications/shares/components/shared.component.ts
@@ -264,7 +264,7 @@ export class SharedComponent implements OnInit {
goTo(share?: ShareFileModel) {
share = share || this.selected
- this.sharesService.goTo(share).catch((e: Error) => console.error(e))
+ this.sharesService.goTo(share).catch(console.error)
}
goToComments(share: ShareFileModel) {
diff --git a/frontend/src/app/applications/spaces/components/spaces-browser.component.ts b/frontend/src/app/applications/spaces/components/spaces-browser.component.ts
index 22278108..b58aadae 100644
--- a/frontend/src/app/applications/spaces/components/spaces-browser.component.ts
+++ b/frontend/src/app/applications/spaces/components/spaces-browser.component.ts
@@ -6,7 +6,7 @@
import { KeyValuePipe, NgTemplateOutlet } from '@angular/common'
import { HttpErrorResponse } from '@angular/common/http'
-import { AfterViewInit, Component, ElementRef, HostListener, NgZone, OnDestroy, OnInit, Renderer2, ViewChild, inject } from '@angular/core'
+import { AfterViewInit, Component, ElementRef, HostListener, inject, NgZone, OnDestroy, OnInit, Renderer2, ViewChild } from '@angular/core'
import { ActivatedRoute, Data, Router, UrlSegment } from '@angular/router'
import { FaIconComponent } from '@fortawesome/angular-fontawesome'
import {
@@ -455,7 +455,7 @@ export class SpacesBrowserComponent implements OnInit, AfterViewInit, OnDestroy
}
if (!file.isRenamed) {
if (file.isDir) {
- this.router.navigate([file.root?.alias || file.name], { relativeTo: this.activatedRoute }).catch((e: Error) => console.error(e))
+ this.router.navigate([file.root?.alias || file.name], { relativeTo: this.activatedRoute }).catch(console.error)
} else {
this.shortcutView()
}
@@ -542,7 +542,7 @@ export class SpacesBrowserComponent implements OnInit, AfterViewInit, OnDestroy
addToSync() {
this.router
.navigate([SYNC_PATH.BASE, SYNC_PATH.WIZARD, SYNC_PATH.WIZARD_CLIENT], { state: { file: this.selection[0] } })
- .catch((e: Error) => console.error(e))
+ .catch(console.error)
}
addToClipboard() {
@@ -642,7 +642,7 @@ export class SpacesBrowserComponent implements OnInit, AfterViewInit, OnDestroy
}
}
}
- this.filesUpload.addFiles(ev.files).catch((e: Error) => console.error(e))
+ this.filesUpload.addFiles(ev.files).catch(console.error)
}
onDropFiles(ev: { dataTransfer: { files: File[] } }) {
diff --git a/frontend/src/app/applications/spaces/components/spaces.component.ts b/frontend/src/app/applications/spaces/components/spaces.component.ts
index 0b598db8..3a81e7ef 100644
--- a/frontend/src/app/applications/spaces/components/spaces.component.ts
+++ b/frontend/src/app/applications/spaces/components/spaces.component.ts
@@ -6,7 +6,7 @@
import { KeyValuePipe } from '@angular/common'
import { HttpErrorResponse } from '@angular/common/http'
-import { Component, ElementRef, OnInit, ViewChild, inject } from '@angular/core'
+import { Component, ElementRef, inject, OnInit, ViewChild } from '@angular/core'
import { ActivatedRoute, Router } from '@angular/router'
import { FaIconComponent } from '@fortawesome/angular-fontawesome'
import {
@@ -197,7 +197,7 @@ export class SpacesComponent implements OnInit {
if (!space.enabled) {
this.layout.sendNotification('warning', space.name, 'Space is disabled')
} else {
- this.router.navigate([SPACES_PATH.FILES, space.alias], { relativeTo: this.activatedRoute }).catch((e: Error) => console.error(e))
+ this.router.navigate([SPACES_PATH.FILES, space.alias], { relativeTo: this.activatedRoute }).catch(console.error)
}
}
diff --git a/frontend/src/app/applications/spaces/components/trash.component.ts b/frontend/src/app/applications/spaces/components/trash.component.ts
index 2ecda082..a557313f 100644
--- a/frontend/src/app/applications/spaces/components/trash.component.ts
+++ b/frontend/src/app/applications/spaces/components/trash.component.ts
@@ -5,7 +5,7 @@
*/
import { KeyValuePipe } from '@angular/common'
-import { Component, ElementRef, OnInit, ViewChild, inject } from '@angular/core'
+import { Component, ElementRef, inject, OnInit, ViewChild } from '@angular/core'
import { Router } from '@angular/router'
import { FaIconComponent } from '@fortawesome/angular-fontawesome'
import { faArrowDown, faArrowRotateRight, faArrowUp, faCircleInfo } from '@fortawesome/free-solid-svg-icons'
@@ -151,6 +151,6 @@ export class TrashComponent implements OnInit {
}
browse(trash: TrashModel) {
- this.router.navigate([SPACES_PATH.SPACES_TRASH, trash.alias]).catch((e: Error) => console.error(e))
+ this.router.navigate([SPACES_PATH.SPACES_TRASH, trash.alias]).catch(console.error)
}
}
diff --git a/frontend/src/app/applications/sync/components/dialogs/sync-path-settings.dialog.component.ts b/frontend/src/app/applications/sync/components/dialogs/sync-path-settings.dialog.component.ts
index dea1be06..a6990db2 100755
--- a/frontend/src/app/applications/sync/components/dialogs/sync-path-settings.dialog.component.ts
+++ b/frontend/src/app/applications/sync/components/dialogs/sync-path-settings.dialog.component.ts
@@ -4,7 +4,7 @@
* See the LICENSE file for licensing details
*/
import { HttpErrorResponse } from '@angular/common/http'
-import { Component, EventEmitter, Input, OnInit, Output, inject } from '@angular/core'
+import { Component, EventEmitter, inject, Input, OnInit, Output } from '@angular/core'
import { FormsModule } from '@angular/forms'
import { FaIconComponent } from '@fortawesome/angular-fontawesome'
import { faRotate, faTimes } from '@fortawesome/free-solid-svg-icons'
@@ -59,7 +59,7 @@ export class SyncPathSettingsDialogComponent implements OnInit {
}
if (this.store.isElectronApp()) {
this.syncService.updatePath(this.syncPath.export(true)).then(() => {
- this.syncService.refreshPaths().catch((e) => console.error(e))
+ this.syncService.refreshPaths().catch(console.error)
this.layout.closeDialog()
})
} else {
@@ -78,7 +78,7 @@ export class SyncPathSettingsDialogComponent implements OnInit {
this.syncService
.removePath(this.syncPath.id)
.then(() => {
- this.syncService.refreshPaths().catch((e) => console.error(e))
+ this.syncService.refreshPaths().catch(console.error)
this.layout.closeDialog()
this.layout.sendNotification('success', 'Sync deleted', this.syncPath.settings.name)
})
diff --git a/frontend/src/app/applications/sync/components/sync-clients.component.ts b/frontend/src/app/applications/sync/components/sync-clients.component.ts
index 6632152b..e229bd38 100644
--- a/frontend/src/app/applications/sync/components/sync-clients.component.ts
+++ b/frontend/src/app/applications/sync/components/sync-clients.component.ts
@@ -142,7 +142,7 @@ export class SyncClientsComponent {
withSettings: true
}
})
- .catch((e: Error) => console.error(e))
+ .catch(console.error)
} else {
const modalRef: BsModalRef<SyncPathSettingsDialogComponent> = this.layout.openDialog(SyncPathSettingsDialogComponent, 'md', {
initialState: { syncPathSelected: this.selectedPath, syncClientSelected: this.selected } as SyncPathSettingsDialogComponent
diff --git a/frontend/src/app/applications/sync/components/sync-paths.component.ts b/frontend/src/app/applications/sync/components/sync-paths.component.ts
index b9b58ae6..64937cb3 100644
--- a/frontend/src/app/applications/sync/components/sync-paths.component.ts
+++ b/frontend/src/app/applications/sync/components/sync-paths.component.ts
@@ -5,7 +5,7 @@
*/
import { KeyValuePipe } from '@angular/common'
-import { Component, effect, OnDestroy, OnInit, ViewChild, inject } from '@angular/core'
+import { Component, effect, inject, OnDestroy, OnInit, ViewChild } from '@angular/core'
import { Router } from '@angular/router'
import { FaIconComponent } from '@fortawesome/angular-fontawesome'
import {
@@ -265,7 +265,7 @@ export class SyncPathsComponent implements OnInit, OnDestroy {
onRefresh() {
this.onSelect()
- this.syncService.refreshPaths().catch((e) => console.error(e))
+ this.syncService.refreshPaths().catch(console.error)
}
doSync(run: boolean) {
@@ -308,7 +308,7 @@ export class SyncPathsComponent implements OnInit, OnDestroy {
}
addToSync() {
- this.router.navigate([SYNC_PATH.BASE, SYNC_PATH.WIZARD]).catch((e) => console.error(e))
+ this.router.navigate([SYNC_PATH.BASE, SYNC_PATH.WIZARD]).catch(console.error)
}
sortBy(column: string, toUpdate = true, collection?: SyncPathModel[]) {
@@ -331,7 +331,7 @@ export class SyncPathsComponent implements OnInit, OnDestroy {
}
showErrors(syncPath: SyncPathModel) {
- this.router.navigate([SYNC_PATH.BASE, SYNC_PATH.TRANSFERS], { state: { id: syncPath.id } }).catch((e: Error) => console.error(e))
+ this.router.navigate([SYNC_PATH.BASE, SYNC_PATH.TRANSFERS], { state: { id: syncPath.id } }).catch(console.error)
}
private checkRouteState() {
diff --git a/frontend/src/app/applications/sync/components/wizard/sync-wizard-client.component.ts b/frontend/src/app/applications/sync/components/wizard/sync-wizard-client.component.ts
index b856b897..eed64db5 100644
--- a/frontend/src/app/applications/sync/components/wizard/sync-wizard-client.component.ts
+++ b/frontend/src/app/applications/sync/components/wizard/sync-wizard-client.component.ts
@@ -3,7 +3,7 @@
* This file is part of Sync-in | The open source file sync and share solution
* See the LICENSE file for licensing details
*/
-import { Component, Renderer2, inject } from '@angular/core'
+import { Component, inject, Renderer2 } from '@angular/core'
import { Router } from '@angular/router'
import { FaIconComponent } from '@fortawesome/angular-fontawesome'
import { faArrowCircleRight, faTimesCircle } from '@fortawesome/free-solid-svg-icons'
@@ -109,11 +109,11 @@ export class SyncWizardClientComponent {
}
onNext() {
- this.router.navigate([SYNC_PATH.BASE, SYNC_PATH.WIZARD, SYNC_PATH.WIZARD_SERVER]).catch((e: Error) => console.error(e))
+ this.router.navigate([SYNC_PATH.BASE, SYNC_PATH.WIZARD, SYNC_PATH.WIZARD_SERVER]).catch(console.error)
}
onCancel() {
- this.router.navigate([SYNC_PATH.BASE, SYNC_PATH.PATHS]).catch((e: Error) => console.error(e))
+ this.router.navigate([SYNC_PATH.BASE, SYNC_PATH.PATHS]).catch(console.error)
this.syncService.resetWizard()
}
diff --git a/frontend/src/app/applications/sync/components/wizard/sync-wizard-server.component.ts b/frontend/src/app/applications/sync/components/wizard/sync-wizard-server.component.ts
index af1a0723..88b56b75 100644
--- a/frontend/src/app/applications/sync/components/wizard/sync-wizard-server.component.ts
+++ b/frontend/src/app/applications/sync/components/wizard/sync-wizard-server.component.ts
@@ -4,7 +4,7 @@
* See the LICENSE file for licensing details
*/
import { HttpErrorResponse } from '@angular/common/http'
-import { Component, signal, ViewChild, WritableSignal, inject } from '@angular/core'
+import { Component, inject, signal, ViewChild, WritableSignal } from '@angular/core'
import { FormsModule, ReactiveFormsModule } from '@angular/forms'
import { Router } from '@angular/router'
import { FaIconComponent } from '@fortawesome/angular-fontawesome'
@@ -128,7 +128,7 @@ export class SyncWizardServerComponent {
this.canCreateDir = false
} else {
const backRoute = segments.length === 2 && segments[0] === SPACES_PATH.FILES ? [SPACES_PATH.SPACES] : segments.slice(0, -1)
- this.browse(backRoute.join('/')).catch((e: Error) => console.error(e))
+ this.browse(backRoute.join('/')).catch(console.error)
}
}
@@ -137,7 +137,7 @@ export class SyncWizardServerComponent {
next: () => {
this.browse(this.currentPath, this.newDirectoryName)
.then(() => (this.newDirectoryName = ''))
- .catch((e: Error) => console.error(e))
+ .catch(console.error)
},
error: (e: HttpErrorResponse) => this.setInfoMsg(e.error.message)
})
@@ -201,11 +201,11 @@ export class SyncWizardServerComponent {
}
onNext() {
- this.router.navigate([SYNC_PATH.BASE, SYNC_PATH.WIZARD, SYNC_PATH.WIZARD_SETTINGS]).catch((e: Error) => console.error(e))
+ this.router.navigate([SYNC_PATH.BASE, SYNC_PATH.WIZARD, SYNC_PATH.WIZARD_SETTINGS]).catch(console.error)
}
onPrevious() {
- this.router.navigate([SYNC_PATH.BASE, SYNC_PATH.WIZARD, SYNC_PATH.WIZARD_CLIENT]).catch((e: Error) => console.error(e))
+ this.router.navigate([SYNC_PATH.BASE, SYNC_PATH.WIZARD, SYNC_PATH.WIZARD_CLIENT]).catch(console.error)
}
setServerPath(serverPath: SyncWizardPath) {
diff --git a/frontend/src/app/applications/sync/components/wizard/sync-wizard-settings.component.ts b/frontend/src/app/applications/sync/components/wizard/sync-wizard-settings.component.ts
index 7d73b22b..e1ef0f22 100644
--- a/frontend/src/app/applications/sync/components/wizard/sync-wizard-settings.component.ts
+++ b/frontend/src/app/applications/sync/components/wizard/sync-wizard-settings.component.ts
@@ -57,7 +57,7 @@ export class SyncWizardSettingsComponent {
}
onPrevious() {
- this.router.navigate([SYNC_PATH.BASE, SYNC_PATH.WIZARD, SYNC_PATH.WIZARD_SERVER]).catch((e: Error) => console.error(e))
+ this.router.navigate([SYNC_PATH.BASE, SYNC_PATH.WIZARD, SYNC_PATH.WIZARD_SERVER]).catch(console.error)
}
async onSubmit() {
@@ -66,7 +66,7 @@ export class SyncWizardSettingsComponent {
this.error = r
} else {
await this.syncService.refreshPaths()
- this.router.navigate([SYNC_PATH.BASE, SYNC_PATH.PATHS], { state: { id: r.id, withSettings: false } }).catch((e: Error) => console.error(e))
+ this.router.navigate([SYNC_PATH.BASE, SYNC_PATH.PATHS], { state: { id: r.id, withSettings: false } }).catch(console.error)
this.syncService.resetWizard()
}
}
diff --git a/frontend/src/app/applications/sync/services/sync.service.ts b/frontend/src/app/applications/sync/services/sync.service.ts
index 7dd660a6..71a82c30 100644
--- a/frontend/src/app/applications/sync/services/sync.service.ts
+++ b/frontend/src/app/applications/sync/services/sync.service.ts
@@ -5,7 +5,7 @@
*/
import { HttpClient } from '@angular/common/http'
-import { Injectable, inject } from '@angular/core'
+import { inject, Injectable } from '@angular/core'
import { Router } from '@angular/router'
import { API_SYNC_CLIENTS, SYNC_ROUTE } from '@sync-in-server/backend/src/applications/sync/constants/routes'
import {
@@ -114,7 +114,7 @@ export class SyncService {
reportOnly: reportOnly,
async: async
})
- .catch((e) => console.error(e))
+ .catch(console.error)
}
async refreshPaths(): Promise<void> {
@@ -138,7 +138,7 @@ export class SyncService {
const repository = segments.shift()
this.router
.navigate([SPACES_PATH.SPACES, ...SYNC_PATH_REPOSITORY[repository], ...segments], name ? { queryParams: { select: name } } : {})
- .catch((e: Error) => console.error(e))
+ .catch(console.error)
}
}
diff --git a/frontend/src/app/applications/sync/sync.guards.ts b/frontend/src/app/applications/sync/sync.guards.ts
index 6b8be2fe..e01c41e0 100644
--- a/frontend/src/app/applications/sync/sync.guards.ts
+++ b/frontend/src/app/applications/sync/sync.guards.ts
@@ -26,7 +26,7 @@ export const syncWizardSettingsActivate: CanActivateFn = (): boolean => {
if (!canActivate) {
inject(Router)
.navigate([SYNC_PATH.BASE, SYNC_PATH.WIZARD, syncService.wizard.localPath ? SYNC_PATH.WIZARD_SERVER : SYNC_PATH.WIZARD_CLIENT])
- .catch((e: Error) => console.error(e))
+ .catch(console.error)
}
return canActivate
}
@@ -37,7 +37,7 @@ export const syncWizardServerActivate: CanActivateFn = (): boolean => {
if (!canActivate) {
inject(Router)
.navigate([SYNC_PATH.BASE, SYNC_PATH.WIZARD, SYNC_PATH.WIZARD_CLIENT])
- .catch((e: Error) => console.error(e))
+ .catch(console.error)
}
return canActivate
}
diff --git a/frontend/src/app/applications/users/components/user-groups.component.ts b/frontend/src/app/applications/users/components/user-groups.component.ts
index 464d4a72..80750bd1 100644
--- a/frontend/src/app/applications/users/components/user-groups.component.ts
+++ b/frontend/src/app/applications/users/components/user-groups.component.ts
@@ -6,7 +6,7 @@
import { KeyValuePipe } from '@angular/common'
import { HttpErrorResponse } from '@angular/common/http'
-import { Component, ElementRef, ViewChild, inject } from '@angular/core'
+import { Component, ElementRef, inject, ViewChild } from '@angular/core'
import { ActivatedRoute, Data, Router, UrlSegment } from '@angular/router'
import { FaIconComponent } from '@fortawesome/angular-fontawesome'
import {
@@ -251,7 +251,7 @@ export class UserGroupsComponent {
browse(m: MemberModel) {
if (m.isGroup) {
- this.router.navigate([m.name], { relativeTo: this.activatedRoute }).catch((e: Error) => console.error(e))
+ this.router.navigate([m.name], { relativeTo: this.activatedRoute }).catch(console.error)
}
}
diff --git a/frontend/src/app/auth/auth.guards.ts b/frontend/src/app/auth/auth.guards.ts
index 4ff74ef5..38827d36 100644
--- a/frontend/src/app/auth/auth.guards.ts
+++ b/frontend/src/app/auth/auth.guards.ts
@@ -15,9 +15,7 @@ export const authGuard: CanActivateFn = (_route: ActivatedRouteSnapshot, state:
export const noAuthGuard: CanActivateFn = (): boolean => {
if (inject(AuthService).isLogged()) {
- inject(Router)
- .navigate([])
- .catch((e: Error) => console.error(e))
+ inject(Router).navigate([]).catch(console.error)
return false
}
return true
diff --git a/frontend/src/app/auth/auth.service.ts b/frontend/src/app/auth/auth.service.ts
index 41e12f19..cc242051 100644
--- a/frontend/src/app/auth/auth.service.ts
+++ b/frontend/src/app/auth/auth.service.ts
@@ -5,7 +5,7 @@
*/
import { HttpClient, HttpErrorResponse, HttpRequest } from '@angular/common/http'
-import { Injectable, inject } from '@angular/core'
+import { inject, Injectable } from '@angular/core'
import { Router } from '@angular/router'
import { CLIENT_TOKEN_EXPIRED_ERROR } from '@sync-in-server/backend/src/applications/sync/constants/auth'
import { API_SYNC_AUTH_COOKIE } from '@sync-in-server/backend/src/applications/sync/constants/routes'
@@ -119,7 +119,7 @@ export class AuthService {
this.layout.clean()
this.store.clean()
if (redirect) {
- this.router.navigate([AUTH_PATHS.BASE, AUTH_PATHS.LOGIN]).catch((e: Error) => console.error(e))
+ this.router.navigate([AUTH_PATHS.BASE, AUTH_PATHS.LOGIN]).catch(console.error)
}
if (expired) {
this.layout.sendNotification('warning', 'Session has expired', 'Please sign in')
@@ -134,7 +134,7 @@ export class AuthService {
next: (r: LoginResponseDto) => {
this.userService.disconnectWebSocket()
this.initUserFromResponse(r)
- this.router.navigate([USER_PATH.BASE, USER_PATH.ACCOUNT]).catch((e: Error) => console.error(e))
+ this.router.navigate([USER_PATH.BASE, USER_PATH.ACCOUNT]).catch(console.error)
},
error: (e: HttpErrorResponse) => {
console.error(e)
diff --git a/frontend/src/app/common/components/only-office.component.ts b/frontend/src/app/common/components/only-office.component.ts
index 63834084..c12cd718 100755
--- a/frontend/src/app/common/components/only-office.component.ts
+++ b/frontend/src/app/common/components/only-office.component.ts
@@ -54,7 +54,7 @@ export class OnlyOfficeComponent implements OnChanges {
.then(() => {
this.createEditor()
})
- .catch((e) => console.error(e))
+ .catch(console.error)
}
}
}
diff --git a/frontend/src/app/electron/electron.service.ts b/frontend/src/app/electron/electron.service.ts
index 8d5e235f..ffbde11d 100644
--- a/frontend/src/app/electron/electron.service.ts
+++ b/frontend/src/app/electron/electron.service.ts
@@ -4,7 +4,7 @@
* See the LICENSE file for licensing details
*/
-import { effect, Injectable, NgZone, inject } from '@angular/core'
+import { effect, inject, Injectable, NgZone } from '@angular/core'
import { toObservable } from '@angular/core/rxjs-interop'
import { FileTask } from '@sync-in-server/backend/src/applications/files/models/file-task'
import type { SyncClientAuthDto } from '@sync-in-server/backend/src/applications/sync/dtos/sync-client-auth.dto'
@@ -118,7 +118,7 @@ export class Electron {
private getSyncsWithErrors() {
this.invoke(EVENT.SYNC.ERRORS)
.then((syncs: SyncStatus[]) => this.store.clientSyncsWithErrors.next(syncs))
- .catch((e) => console.error(e))
+ .catch(console.error)
}
private updateSyncMenuIcon() {
diff --git a/frontend/src/app/layout/sidebar/sidebar.left.component.ts b/frontend/src/app/layout/sidebar/sidebar.left.component.ts
index 5b25616f..4f5ce639 100644
--- a/frontend/src/app/layout/sidebar/sidebar.left.component.ts
+++ b/frontend/src/app/layout/sidebar/sidebar.left.component.ts
@@ -5,7 +5,7 @@
*/
import { AsyncPipe, Location, NgComponentOutlet, NgTemplateOutlet } from '@angular/common'
-import { Component, ElementRef, OnDestroy, Renderer2, ViewChild, inject } from '@angular/core'
+import { Component, ElementRef, inject, OnDestroy, Renderer2, ViewChild } from '@angular/core'
import { ResolveEnd, Router, RouterLink } from '@angular/router'
import { FaIconComponent } from '@fortawesome/angular-fontawesome'
import { faAngleLeft, faAngleRight, faUserSecret } from '@fortawesome/free-solid-svg-icons'
@@ -114,7 +114,7 @@ export class SideBarLeftComponent implements OnDestroy {
checkComponentRoute(menu?: AppMenu) {
if (this.currentMenu.link !== this.currentUrl) {
- this.router.navigate([this.currentMenu.link]).catch((e: Error) => console.error(e))
+ this.router.navigate([this.currentMenu.link]).catch(console.error)
}
if (menu) {
menu.miniOpened = false
diff --git a/frontend/src/main.ts b/frontend/src/main.ts
index bdd0414e..4b649184 100644
--- a/frontend/src/main.ts
+++ b/frontend/src/main.ts
@@ -8,4 +8,4 @@ import { bootstrapApplication } from '@angular/platform-browser'
import { AppComponent } from './app/app.component'
import { appConfig } from './app/app.config'
-bootstrapApplication(AppComponent, appConfig).catch((e) => console.error(e))
+bootstrapApplication(AppComponent, appConfig).catch(console.error)