Skip to content

Commit

Permalink
fix: add missing rethrows
Browse files Browse the repository at this point in the history
  • Loading branch information
simonknittel committed Jan 12, 2025
1 parent c56a87d commit 9ee1c0b
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 2 deletions.
3 changes: 2 additions & 1 deletion app/src/algolia/actions/updateIndices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import { prisma } from "@/db";
import { log } from "@/logging";
import { unstable_rethrow } from "next/navigation";
import { serializeError } from "serialize-error";
import { getIndex } from "..";

Expand Down Expand Up @@ -63,10 +64,10 @@ export const updateIndices = async () => {
success: "Successfully updated Algolia indices",
};
} catch (error) {
unstable_rethrow(error);
void log.error("Failed to update Algolia indices", {
error: serializeError(error),
});

return {
error: "Failed to update Algolia indices",
};
Expand Down
2 changes: 2 additions & 0 deletions app/src/career/actions/updateFlow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
FlowNodeType,
} from "@prisma/client";
import { revalidatePath } from "next/cache";
import { unstable_rethrow } from "next/navigation";
import { serializeError } from "serialize-error";
import { z } from "zod";

Expand Down Expand Up @@ -170,6 +171,7 @@ export const updateFlow = async (formData: FormData) => {
success: "Erfolgreich gespeichert.",
};
} catch (error) {
unstable_rethrow(error);
void log.error("Internal Server Error", { error: serializeError(error) });
return {
error:
Expand Down
3 changes: 3 additions & 0 deletions app/src/common/actions/serverActionErrorHandler.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { log } from "@/logging";
import { PrismaClientKnownRequestError } from "@prisma/client/runtime/library";
import { unstable_rethrow } from "next/navigation";
import { serializeError } from "serialize-error";
import { ZodError } from "zod";
import { type ServerActionResponse } from "./types";
Expand All @@ -17,6 +18,8 @@ export const serverActionErrorHandler = (
};
},
): ServerActionResponse => {
unstable_rethrow(error);

if (
error instanceof ZodError ||
(error instanceof Error &&
Expand Down
2 changes: 2 additions & 0 deletions app/src/fleet/actions/createShipAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { authenticateAction } from "@/auth/server";
import { prisma } from "@/db";
import { log } from "@/logging";
import { revalidatePath } from "next/cache";
import { unstable_rethrow } from "next/navigation";
import { serializeError } from "serialize-error";
import { z } from "zod";

Expand Down Expand Up @@ -55,6 +56,7 @@ export const createShipAction = async (formData: FormData) => {
success: "Das Schiff wurde erfolgreich hinzugefügt.",
};
} catch (error) {
unstable_rethrow(error);
void log.error("Internal Server Error", { error: serializeError(error) });
return {
error:
Expand Down
2 changes: 2 additions & 0 deletions app/src/fleet/actions/createVariant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { prisma } from "@/db";
import { log } from "@/logging";
import { VariantStatus } from "@prisma/client";
import { revalidatePath } from "next/cache";
import { unstable_rethrow } from "next/navigation";
import { serializeError } from "serialize-error";
import { z } from "zod";
import { createAndReturnTags } from "../utils/createAndReturnTags";
Expand Down Expand Up @@ -93,6 +94,7 @@ export const createVariant = async (formData: FormData) => {
success: "Erfolgreich gespeichert.",
};
} catch (error) {
unstable_rethrow(error);
void log.error("Internal Server Error", { error: serializeError(error) });
return {
error:
Expand Down
3 changes: 2 additions & 1 deletion app/src/roles/actions/deleteRole.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import { authenticateAction } from "@/auth/server";
import { prisma } from "@/db";
import { log } from "@/logging";
import { redirect } from "next/navigation";
import { redirect, unstable_rethrow } from "next/navigation";
import { serializeError } from "serialize-error";
import { z } from "zod";

Expand Down Expand Up @@ -49,6 +49,7 @@ export const deleteRole = async (
*/
redirect("/app/roles");
} catch (error) {
unstable_rethrow(error);
void log.error("Internal Server Error", { error: serializeError(error) });
return {
error:
Expand Down
2 changes: 2 additions & 0 deletions app/src/roles/actions/updateRoleName.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { authenticateAction } from "@/auth/server";
import { prisma } from "@/db";
import { log } from "@/logging";
import { revalidatePath } from "next/cache";
import { unstable_rethrow } from "next/navigation";
import { serializeError } from "serialize-error";
import { z } from "zod";

Expand Down Expand Up @@ -62,6 +63,7 @@ export const updateRoleName = async (
success: "Erfolgreich gespeichert.",
};
} catch (error) {
unstable_rethrow(error);
void log.error("Internal Server Error", { error: serializeError(error) });
return {
error:
Expand Down
2 changes: 2 additions & 0 deletions app/src/roles/actions/updateRolePermissions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { authenticateAction } from "@/auth/server";
import { prisma } from "@/db";
import { log } from "@/logging";
import { revalidatePath } from "next/cache";
import { unstable_rethrow } from "next/navigation";
import { serializeError } from "serialize-error";
import { z } from "zod";

Expand Down Expand Up @@ -77,6 +78,7 @@ export const updateRolePermissions = async (
success: "Erfolgreich gespeichert.",
};
} catch (error) {
unstable_rethrow(error);
void log.error("Internal Server Error", { error: serializeError(error) });
return {
error:
Expand Down
2 changes: 2 additions & 0 deletions app/src/users/actions/verifyEmail.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { authenticateAction } from "@/auth/server";
import { prisma } from "@/db";
import { log } from "@/logging";
import { revalidatePath } from "next/cache";
import { unstable_rethrow } from "next/navigation";
import { serializeError } from "serialize-error";
import { z } from "zod";

Expand Down Expand Up @@ -63,6 +64,7 @@ export const verifyEmailAction = async (formData: FormData) => {
success: "Erfolgreich gespeichert",
};
} catch (error) {
unstable_rethrow(error);
void log.error("Internal Server Error", { error: serializeError(error) });
return {
error:
Expand Down

0 comments on commit 9ee1c0b

Please sign in to comment.