@@ -6,9 +6,9 @@ import { OrchestrationError } from '@/lib/core/orchestration/types'
66import { TableRowLimitError } from '@/lib/table/billing'
77import type { ColumnDefinition } from '@/lib/table/types'
88import {
9+ orchestrationErrorResponse ,
910 orchestrationOutcomeErrorResponse ,
1011 rootErrorMessage ,
11- rowWriteErrorResponse ,
1212 tableFilterError ,
1313} from '@/app/api/table/utils'
1414
@@ -34,9 +34,9 @@ describe('rootErrorMessage', () => {
3434 } )
3535} )
3636
37- describe ( 'rowWriteErrorResponse ' , ( ) => {
37+ describe ( 'orchestrationErrorResponse ' , ( ) => {
3838 it ( 'passes the plan row-limit error through as a 400' , async ( ) => {
39- const response = rowWriteErrorResponse ( new TableRowLimitError ( 10000 ) )
39+ const response = orchestrationErrorResponse ( new TableRowLimitError ( 10000 ) )
4040 expect ( response ?. status ) . toBe ( 400 )
4141 const body = await response ?. json ( )
4242 expect ( body . error ) . toBe (
@@ -45,7 +45,7 @@ describe('rowWriteErrorResponse', () => {
4545 } )
4646
4747 it ( 'passes a classified validation failure through as 400' , async ( ) => {
48- const response = rowWriteErrorResponse (
48+ const response = orchestrationErrorResponse (
4949 new OrchestrationError ( 'validation' , 'Value for column "email" must be unique' )
5050 )
5151 expect ( response ?. status ) . toBe ( 400 )
@@ -55,24 +55,26 @@ describe('rowWriteErrorResponse', () => {
5555
5656 it ( 'answers the code the failure carries, not one derived from its wording' , ( ) => {
5757 expect (
58- rowWriteErrorResponse ( new OrchestrationError ( 'not_found' , 'Row not found' ) ) ?. status
58+ orchestrationErrorResponse ( new OrchestrationError ( 'not_found' , 'Row not found' ) ) ?. status
5959 ) . toBe ( 404 )
6060 // The phrase that used to force a 400 no longer decides anything.
6161 expect (
62- rowWriteErrorResponse ( new OrchestrationError ( 'conflict' , 'Row 3: must be unique' ) ) ?. status
62+ orchestrationErrorResponse ( new OrchestrationError ( 'conflict' , 'Row 3: must be unique' ) )
63+ ?. status
6364 ) . toBe ( 409 )
6465 } )
6566
6667 it ( 'unwraps a classified failure drizzle wrapped in a query error' , ( ) => {
6768 expect (
68- rowWriteErrorResponse ( wrapLikeDrizzle ( new OrchestrationError ( 'validation' , 'Row 3: bad' ) ) )
69- ?. status
69+ orchestrationErrorResponse (
70+ wrapLikeDrizzle ( new OrchestrationError ( 'validation' , 'Row 3: bad' ) )
71+ ) ?. status
7072 ) . toBe ( 400 )
7173 } )
7274
7375 it ( 'returns null for unknown errors so callers keep their generic 500' , ( ) => {
74- expect ( rowWriteErrorResponse ( new Error ( 'connection refused' ) ) ) . toBeNull ( )
75- expect ( rowWriteErrorResponse ( wrapLikeDrizzle ( new Error ( 'deadlock detected' ) ) ) ) . toBeNull ( )
76+ expect ( orchestrationErrorResponse ( new Error ( 'connection refused' ) ) ) . toBeNull ( )
77+ expect ( orchestrationErrorResponse ( wrapLikeDrizzle ( new Error ( 'deadlock detected' ) ) ) ) . toBeNull ( )
7678 } )
7779} )
7880
0 commit comments