build fix
This commit is contained in:
parent
9ebfd23321
commit
67fe023cbc
@ -127,7 +127,10 @@ export async function DELETE(
|
||||
} catch (error) {
|
||||
console.error("Error deleting announcement:", error);
|
||||
const errorMessage = error instanceof Error ? error.message : "Unknown error";
|
||||
const errorCode = error.code || "UNKNOWN";
|
||||
// Use a type guard to safely access the 'code' property
|
||||
const errorCode = typeof error === 'object' && error !== null && 'code' in error
|
||||
? (error as { code: unknown }).code?.toString() || "UNKNOWN"
|
||||
: "UNKNOWN";
|
||||
|
||||
return NextResponse.json({
|
||||
error: "Failed to delete announcement",
|
||||
|
||||
@ -116,7 +116,10 @@ export async function POST(req: NextRequest) {
|
||||
console.error("Error creating announcement:", error);
|
||||
// Return more detailed error information
|
||||
const errorMessage = error instanceof Error ? error.message : "Unknown error";
|
||||
const errorCode = error.code || "UNKNOWN";
|
||||
// Use a type guard to safely access the 'code' property
|
||||
const errorCode = typeof error === 'object' && error !== null && 'code' in error
|
||||
? (error as { code: unknown }).code?.toString() || "UNKNOWN"
|
||||
: "UNKNOWN";
|
||||
|
||||
return NextResponse.json({
|
||||
error: "Failed to create announcement",
|
||||
|
||||
Loading…
Reference in New Issue
Block a user