(error: unknown)
| 10 | * and user-facing copy stay identical instead of being re-typed per route. |
| 11 | */ |
| 12 | export function docNotReadyResponse(error: unknown): NextResponse | null { |
| 13 | if (error instanceof DocCompileUserError) { |
| 14 | return NextResponse.json( |
| 15 | { |
| 16 | success: false, |
| 17 | error: 'A document is still being generated. Wait for it to finish, then try again.', |
| 18 | }, |
| 19 | { status: 409 } |
| 20 | ) |
| 21 | } |
| 22 | return null |
| 23 | } |