Skip to content

Commit 3a4019c

Browse files
Fix/file bugs (#386)
* fix(file): rename file issue * fix(file): add server error handler * fix(file): refactor * Update src/app/features/files/store/files.state.ts Co-authored-by: nsemets <nsemets@exoft.net> * fix(file): refactor --------- Co-authored-by: nsemets <nsemets@exoft.net>
1 parent 52197b0 commit 3a4019c

File tree

5 files changed

+13
-12
lines changed

5 files changed

+13
-12
lines changed

src/app/core/interceptors/error.interceptor.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ export const errorInterceptor: HttpInterceptorFn = (req, next) => {
3131
}
3232
}
3333

34+
const serverErrorRegex = /5\d{2}/;
35+
36+
if (serverErrorRegex.test(error.status.toString())) {
37+
errorMessage = error.error.message || 'common.errorMessages.serverError';
38+
}
39+
3440
if (error.status === 401) {
3541
if (!hasViewOnlyParam(router)) {
3642
authService.logout();

src/app/features/files/store/files.state.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,8 @@ export class FilesState {
129129
ctx.dispatch(new GetRootFolderFiles(action.resourceId));
130130
}
131131
},
132-
})
132+
}),
133+
catchError((error) => handleSectionError(ctx, 'files', error))
133134
);
134135
}
135136

@@ -148,7 +149,8 @@ export class FilesState {
148149
ctx.dispatch(new GetRootFolderFiles(action.resourceId));
149150
}
150151
},
151-
})
152+
}),
153+
catchError((error) => handleSectionError(ctx, 'files', error))
152154
);
153155
}
154156

src/app/features/moderation/components/add-moderator-dialog/add-moderator-dialog.component.scss

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,6 @@
77
cursor: pointer;
88
}
99

10-
.users-list {
11-
height: 30vh;
12-
overflow: auto;
13-
}
14-
1510
.border-divider {
1611
border-bottom: 1px solid var.$grey-2;
1712
}

src/app/shared/components/contributors/add-contributor-dialog/add-contributor-dialog.component.scss

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,6 @@
66
cursor: pointer;
77
}
88

9-
.users-list {
10-
height: 30vh;
11-
overflow: auto;
12-
}
13-
149
.border-divider {
1510
border-bottom: 1px solid var(--grey-2);
1611
}

src/assets/i18n/en.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,9 @@
156156
"hint": {
157157
"tagSeparators": "Use enter or comma to create a tag.",
158158
"viewOnlyLinksBanner": "You are viewing OSF through a view-only link, which may limit the data you have permission to see."
159+
},
160+
"errorMessages": {
161+
"serverError": "An unexpected error occurred. Please try again later."
159162
}
160163
},
161164
"navigation": {

0 commit comments

Comments
 (0)