@@ -21,7 +21,9 @@ test('parseAPIError - handles Ollama unmarshal error from issue #87', t => {
2121} ) ;
2222
2323test ( 'parseAPIError - handles unmarshal error without retry wrapper' , t => {
24- const error = new Error ( "unmarshal: invalid character '{' after top-level value" ) ;
24+ const error = new Error (
25+ "unmarshal: invalid character '{' after top-level value" ,
26+ ) ;
2527
2628 const result = parseAPIError ( error ) ;
2729
@@ -44,7 +46,9 @@ test('parseAPIError - handles 500 error with invalid character (status code take
4446} ) ;
4547
4648test ( 'parseAPIError - handles 500 error without JSON parsing issue' , t => {
47- const error = new Error ( '500 Internal Server Error: database connection failed' ) ;
49+ const error = new Error (
50+ '500 Internal Server Error: database connection failed' ,
51+ ) ;
4852
4953 const result = parseAPIError ( error ) ;
5054
@@ -85,30 +89,30 @@ test('parseAPIError - handles non-Error objects', t => {
8589} ) ;
8690
8791test ( 'parseAPIError - handles context length errors' , t => {
88- const error = new Error (
89- 'context length exceeded' ,
90- ) ;
92+ const error = new Error ( 'context length exceeded' ) ;
9193
9294 const result = parseAPIError ( error ) ;
9395
9496 // Use exact assertion instead of OR condition
95- t . is ( result , 'Context too large: Please reduce the conversation length or message size' ) ;
97+ t . is (
98+ result ,
99+ 'Context too large: Please reduce the conversation length or message size' ,
100+ ) ;
96101} ) ;
97102
98103test ( 'parseAPIError - handles too many tokens errors' , t => {
99- const error = new Error (
100- 'too many tokens in the request' ,
101- ) ;
104+ const error = new Error ( 'too many tokens in the request' ) ;
102105
103106 const result = parseAPIError ( error ) ;
104107
105- t . is ( result , 'Context too large: Please reduce the conversation length or message size' ) ;
108+ t . is (
109+ result ,
110+ 'Context too large: Please reduce the conversation length or message size' ,
111+ ) ;
106112} ) ;
107113
108114test ( 'parseAPIError - handles 400 with context length in message' , t => {
109- const error = new Error (
110- '400 Bad Request: context length exceeded' ,
111- ) ;
115+ const error = new Error ( '400 Bad Request: context length exceeded' ) ;
112116
113117 const result = parseAPIError ( error ) ;
114118
@@ -137,7 +141,10 @@ test('parseAPIError - handles 429 rate limit error', t => {
137141
138142 const result = parseAPIError ( error ) ;
139143
140- t . is ( result , 'Rate limit exceeded: Too many requests. Please wait and try again' ) ;
144+ t . is (
145+ result ,
146+ 'Rate limit exceeded: Too many requests. Please wait and try again' ,
147+ ) ;
141148} ) ;
142149
143150test ( 'parseAPIError - handles 502 bad gateway error' , t => {
@@ -161,11 +168,16 @@ test('parseAPIError - handles reduce tokens message', t => {
161168
162169 const result = parseAPIError ( error ) ;
163170
164- t . is ( result , 'Too many tokens: Please shorten your message or clear conversation history' ) ;
171+ t . is (
172+ result ,
173+ 'Too many tokens: Please shorten your message or clear conversation history' ,
174+ ) ;
165175} ) ;
166176
167177test ( 'parseAPIError - cleans up unknown errors' , t => {
168- const error = new Error ( 'Error: Something unexpected happened\nWith more details' ) ;
178+ const error = new Error (
179+ 'Error: Something unexpected happened\nWith more details' ,
180+ ) ;
169181
170182 const result = parseAPIError ( error ) ;
171183
0 commit comments