@@ -131,9 +131,11 @@ describe("native PDF provider API calls", () => {
131131
132132 const error = await pdfNativeProviders
133133 . anthropicAnalyzePdf ( makeAnthropicAnalyzeParams ( ) )
134- . catch ( ( caught : unknown ) => caught as Error ) ;
134+ . catch ( ( caught : unknown ) => caught ) ;
135135
136- expect ( error ) . toBeInstanceOf ( Error ) ;
136+ if ( ! ( error instanceof Error ) ) {
137+ throw new Error ( "expected Anthropic PDF request to throw an Error" ) ;
138+ }
137139 expect ( error . message ) . toContain ( "Anthropic PDF request failed" ) ;
138140 expect ( error . message ) . not . toContain ( "tail-marker" ) ;
139141 expect ( error . message . length ) . toBeLessThan ( 500 ) ;
@@ -160,13 +162,15 @@ describe("native PDF provider API calls", () => {
160162 const error = await Promise . race ( [
161163 pdfNativeProviders
162164 . anthropicAnalyzePdf ( makeAnthropicAnalyzeParams ( ) )
163- . catch ( ( caught : unknown ) => caught as Error ) ,
165+ . catch ( ( caught : unknown ) => caught ) ,
164166 new Promise < Error > ( ( _resolve , reject ) => {
165167 setTimeout ( ( ) => reject ( new Error ( "timed out waiting for bounded error body" ) ) , 500 ) ;
166168 } ) ,
167169 ] ) ;
168170
169- expect ( error ) . toBeInstanceOf ( Error ) ;
171+ if ( ! ( error instanceof Error ) ) {
172+ throw new Error ( "expected Anthropic PDF request to throw an Error" ) ;
173+ }
170174 expect ( error . message ) . toContain ( "Anthropic PDF request failed" ) ;
171175 expect ( canceled ) . toBe ( true ) ;
172176 } ) ;
0 commit comments