Skip to content

Commit a314b91

Browse files
committed
Handle new error response format on frontend.
----------------------- After the introduction of new exception classes on backend the error response format is changed. As in new error response error subcode should be accessed on error.sub_code this commit handles this case. Also change in subcode to identify project is private and cannot be accessed by user has been addressed.
1 parent 992c1dd commit a314b91

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

frontend/src/utils/promise.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export async function handleErrors(response) {
2424
.clone()
2525
.json()
2626
.then((res) => {
27-
text = res.SubCode || response.statusText;
27+
text = res.error?.sub_code || res.SubCode || response.statusText;
2828
});
2929
throw Error(text);
3030
}

frontend/src/views/project.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ export const ProjectDetailPage = () => {
198198
)}
199199
{error && (
200200
<>
201-
{error.message === 'PrivateProject' ? (
201+
{error.message === 'PRIVATE_PROJECT_NOT_ALLOWED' ? (
202202
<PrivateProjectError />
203203
) : (
204204
<NotFound projectId={id} />

0 commit comments

Comments
 (0)