Skip to content

Commit

Permalink
#664 💡 manage comments + todos
Browse files Browse the repository at this point in the history
  • Loading branch information
vjohnslhm committed Dec 16, 2024
1 parent debd841 commit dda34a3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
1 change: 0 additions & 1 deletion wls-gui-wahllokalsystem/src/api/WLSError.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { STATUS_INDICATORS } from "@/constants";

// todo: umbenennen in WLSError?
export default class WLSError extends Error {
level: string;
category: string;
Expand Down
7 changes: 3 additions & 4 deletions wls-gui-wahllokalsystem/src/api/fetch-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export function patchConfig(body: any): RequestInit {
*/
export function defaultResponseHandler(
response: Response,
errorMessage = "Es ist ein unbekannter Fehler aufgetreten." // todo: warum hier nochmal die message wenn im error schon ein default wert steht
errorMessage = "Es ist ein unbekannter Fehler aufgetreten."
): void {
if (!response.ok) {
if (response.status === 403) {
Expand All @@ -104,9 +104,9 @@ export function defaultResponseHandler(

/**
* Default catch handler for all service requests.
* Currently only throws an ApiError // todo: api error ersetzen
* Currently only throws an WLSError
* @param error The error object from fetch command
* @param errorMessage The error message to be included in the ApiError object. // todo: api error ersetzen
* @param errorMessage The error message to be included in the WLSError object.
*/
export function defaultCatchHandler(
error: Error,
Expand Down Expand Up @@ -136,7 +136,6 @@ export function wlsCatchHandler(response: Response): PromiseLike<never> {
if (response.status === 400) {
return response.json().then((content) => {
if (WLSError.isWLSException(content)) {
// todo: wird das noch benötigt, wenn es nur noch die wls exception gibt
return Promise.reject(
new WLSError({
level: STATUS_INDICATORS.ERROR,
Expand Down

0 comments on commit dda34a3

Please sign in to comment.