fork of hey-api/openapi-ts because I need some additional things

Update snapshots and examples with fetch exception handling

Co-authored-by: mrlubos <12529395+mrlubos@users.noreply.github.com>

+4852 -143
+34 -1
examples/openapi-ts-fastify/src/client/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
examples/openapi-ts-fetch/src/client/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
examples/openapi-ts-openai/src/client/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+29 -1
examples/openapi-ts-pinia-colada/src/client/client/client.gen.ts
··· 85 85 // fetch must be assigned here, otherwise it would throw the error: 86 86 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 87 87 const _fetch = opts.fetch! 88 - let response = await _fetch(request) 88 + let response: Response 89 + 90 + try { 91 + response = await _fetch(request) 92 + } catch (error) { 93 + // Handle fetch exceptions (AbortError, network errors, etc.) 94 + let finalError = error 95 + 96 + for (const fn of interceptors.error.fns) { 97 + if (fn) { 98 + finalError = (await fn(error, undefined as any, request, opts)) as unknown 99 + } 100 + } 101 + 102 + finalError = finalError || ({} as unknown) 103 + 104 + if (opts.throwOnError) { 105 + throw finalError 106 + } 107 + 108 + // Return error response 109 + return opts.responseStyle === 'data' 110 + ? undefined 111 + : { 112 + error: finalError, 113 + request, 114 + response: undefined as any 115 + } 116 + } 89 117 90 118 for (const fn of interceptors.response.fns) { 91 119 if (fn) {
+34 -1
examples/openapi-ts-tanstack-react-query/src/client/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
examples/openapi-ts-tanstack-svelte-query/src/client/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+29 -1
examples/openapi-ts-tanstack-vue-query/src/client/client/client.gen.ts
··· 85 85 // fetch must be assigned here, otherwise it would throw the error: 86 86 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 87 87 const _fetch = opts.fetch! 88 - let response = await _fetch(request) 88 + let response: Response 89 + 90 + try { 91 + response = await _fetch(request) 92 + } catch (error) { 93 + // Handle fetch exceptions (AbortError, network errors, etc.) 94 + let finalError = error 95 + 96 + for (const fn of interceptors.error.fns) { 97 + if (fn) { 98 + finalError = (await fn(error, undefined as any, request, opts)) as unknown 99 + } 100 + } 101 + 102 + finalError = finalError || ({} as unknown) 103 + 104 + if (opts.throwOnError) { 105 + throw finalError 106 + } 107 + 108 + // Return error response 109 + return opts.responseStyle === 'data' 110 + ? undefined 111 + : { 112 + error: finalError, 113 + request, 114 + response: undefined as any 115 + } 116 + } 89 117 90 118 for (const fn of interceptors.response.fns) { 91 119 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/body-response-text-plain/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/form-data/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes-instance/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/default/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/instance/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/throwOnError/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/transformers/type-format-valibot/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/transformers/type-format-zod/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/typescript/transforms-read-write-custom-name/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/typescript/transforms-read-write-ignore/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/asClass/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/fetch/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/asClass/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/fetch/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/name-builder/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/asClass/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/fetch/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/name-builder/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/asClass/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/fetch/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/name-builder/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/asClass/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/fetch/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/name-builder/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/asClass/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/fetch/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/name-builder/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/schema-unknown/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-api-key/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-basic/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-false/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-oauth2/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers-base-path/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers-host/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/transforms-read-write/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/body-response-text-plain/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/internal-name-conflict/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/parameter-explode-false/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes-instance/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/default/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/instance/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/throwOnError/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/transformers/type-format-valibot/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/transformers/type-format-zod/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/typescript/transforms-read-write-custom-name/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/typescript/transforms-read-write-ignore/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/asClass/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/fetch/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/asClass/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/fetch/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/name-builder/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/asClass/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/fetch/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/name-builder/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/asClass/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/fetch/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/name-builder/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/asClass/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/fetch/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/name-builder/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/asClass/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/fetch/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/name-builder/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-api-key/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-false/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-http-bearer/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-oauth2/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-open-id-connect/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/servers/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-all-of/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-any-of-null/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-array/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-recursive/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transforms-read-write/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/body-response-text-plain/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-false/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-number/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-strict/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-string/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/clean-false/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/default/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/import-file-extension-ts/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/sdk-client-optional/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/sdk-client-required/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/tsconfig-nodenext-sdk/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/headers/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/internal-name-conflict/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/pagination-ref/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/parameter-explode-false/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/client-fetch/sdk-nested-classes-instance/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/client-fetch/sdk-nested-classes/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/default/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/instance/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/throwOnError/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/transformers/type-format-valibot/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/transformers/type-format-zod/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/typescript/transforms-read-write-custom-name/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/typescript/transforms-read-write-ignore/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/asClass/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/fetch/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/asClass/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/fetch/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/name-builder/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/asClass/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/fetch/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/name-builder/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/asClass/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/fetch/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/name-builder/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/asClass/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/fetch/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/name-builder/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/asClass/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/fetch/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/name-builder/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-api-key/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-false/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-http-bearer/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-oauth2/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-open-id-connect/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/servers/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-fetch/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-all-of/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-any-of-null/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-array/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-recursive/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transforms-read-write/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/main/test/__snapshots__/plugins/@tanstack/meta/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/sdks/__snapshots__/method-class-conflict/class/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/sdks/__snapshots__/method-class-conflict/flat/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/sdks/__snapshots__/method-class-conflict/instance/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/sdks/__snapshots__/opencode/flat/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {
+34 -1
packages/openapi-ts-tests/sdks/__snapshots__/opencode/grouped/client/client.gen.ts
··· 95 95 // fetch must be assigned here, otherwise it would throw the error: 96 96 // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 97 const _fetch = opts.fetch!; 98 - let response = await _fetch(request); 98 + let response: Response; 99 + 100 + try { 101 + response = await _fetch(request); 102 + } catch (error) { 103 + // Handle fetch exceptions (AbortError, network errors, etc.) 104 + let finalError = error; 105 + 106 + for (const fn of interceptors.error.fns) { 107 + if (fn) { 108 + finalError = (await fn( 109 + error, 110 + undefined as any, 111 + request, 112 + opts, 113 + )) as unknown; 114 + } 115 + } 116 + 117 + finalError = finalError || ({} as unknown); 118 + 119 + if (opts.throwOnError) { 120 + throw finalError; 121 + } 122 + 123 + // Return error response 124 + return opts.responseStyle === 'data' 125 + ? undefined 126 + : { 127 + error: finalError, 128 + request, 129 + response: undefined as any, 130 + }; 131 + } 99 132 100 133 for (const fn of interceptors.response.fns) { 101 134 if (fn) {