Manage stakeholders implemented
This commit is contained in:
@@ -21,7 +21,8 @@ export type ApiErrorCode =
|
||||
| "rate_limited"
|
||||
| "server_misconfigured"
|
||||
| "mail_failed"
|
||||
| "internal_error";
|
||||
| "internal_error"
|
||||
| "conflict";
|
||||
|
||||
export interface ApiErrorBody {
|
||||
error: { code: ApiErrorCode; message: string };
|
||||
@@ -66,6 +67,10 @@ export function forbidden(message = "Forbidden"): NextResponse {
|
||||
return errorJson("forbidden", message, 403);
|
||||
}
|
||||
|
||||
export function conflict(message = "Conflict"): NextResponse {
|
||||
return errorJson("conflict", message, 409);
|
||||
}
|
||||
|
||||
export function rateLimited(retryAfterMs: number): NextResponse {
|
||||
const retryAfterSec = Math.max(1, Math.ceil(retryAfterMs / 1000));
|
||||
return errorJson("rate_limited", "Too many requests", 429, {
|
||||
|
||||
Reference in New Issue
Block a user