Skip to content

Commit 6935f50

Browse files
committed
fix: update type signature of getErrorDetail
1 parent 8fb4496 commit 6935f50

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

site/src/api/errors.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,15 +110,18 @@ export const getValidationErrorMessage = (error: unknown): string => {
110110
return validationErrors.map((error) => error.detail).join("\n");
111111
};
112112

113-
export const getErrorDetail = (error: unknown): string | null => {
113+
export const getErrorDetail = (error: unknown): string | undefined => {
114114
if (error instanceof Error) {
115115
return "Please check the developer console for more details.";
116116
}
117+
117118
if (isApiError(error)) {
118-
return error.response.data.detail ?? null;
119+
return error.response.data.detail;
119120
}
121+
120122
if (isApiErrorResponse(error)) {
121-
return error.detail ?? null;
123+
return error.detail;
122124
}
123-
return null;
125+
126+
return undefined;
124127
};

0 commit comments

Comments
 (0)