diff --git a/modules/openapi-generator/src/main/resources/dart/libraries/dio/api.mustache b/modules/openapi-generator/src/main/resources/dart/libraries/dio/api.mustache index b019de39c6..328506457c 100644 --- a/modules/openapi-generator/src/main/resources/dart/libraries/dio/api.mustache +++ b/modules/openapi-generator/src/main/resources/dart/libraries/dio/api.mustache @@ -76,7 +76,7 @@ class {{classname}} { try { {{#useBuiltValue}}{{>serialization/built_value/serialize}}{{/useBuiltValue}} - } catch(error) { + } catch(error, stackTrace) { throw DioError( requestOptions: _options.compose( _dio.options, @@ -85,7 +85,7 @@ class {{classname}} { ), type: DioErrorType.other, error: error, - ); + )..stackTrace = stackTrace; } {{/hasBodyOrFormParams}} @@ -104,13 +104,13 @@ class {{classname}} { try { {{#useBuiltValue}}{{>serialization/built_value/deserialize}}{{/useBuiltValue}} - } catch (error) { + } catch (error, stackTrace) { throw DioError( requestOptions: _response.requestOptions, response: _response, type: DioErrorType.other, error: error, - ); + )..stackTrace = stackTrace; } return Response<{{{returnType}}}>( diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/api/another_fake_api.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/api/another_fake_api.dart index 6730b6925a..a65b964794 100644 --- a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/api/another_fake_api.dart +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/api/another_fake_api.dart @@ -52,7 +52,7 @@ class AnotherFakeApi { const _type = FullType(ModelClient); _bodyData = _serializers.serialize(modelClient, specifiedType: _type); - } catch(error) { + } catch(error, stackTrace) { throw DioError( requestOptions: _options.compose( _dio.options, @@ -61,7 +61,7 @@ class AnotherFakeApi { ), type: DioErrorType.other, error: error, - ); + )..stackTrace = stackTrace; } final _response = await _dio.request( @@ -83,13 +83,13 @@ class AnotherFakeApi { specifiedType: _responseType, ) as ModelClient; - } catch (error) { + } catch (error, stackTrace) { throw DioError( requestOptions: _response.requestOptions, response: _response, type: DioErrorType.other, error: error, - ); + )..stackTrace = stackTrace; } return Response( diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/api/default_api.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/api/default_api.dart index 1311f160e5..22b4500214 100644 --- a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/api/default_api.dart +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/api/default_api.dart @@ -62,13 +62,13 @@ class DefaultApi { specifiedType: _responseType, ) as InlineResponseDefault; - } catch (error) { + } catch (error, stackTrace) { throw DioError( requestOptions: _response.requestOptions, response: _response, type: DioErrorType.other, error: error, - ); + )..stackTrace = stackTrace; } return Response( diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/api/fake_api.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/api/fake_api.dart index c3915495c8..b5d03c9bda 100644 --- a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/api/fake_api.dart +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/api/fake_api.dart @@ -72,13 +72,13 @@ class FakeApi { specifiedType: _responseType, ) as HealthCheckResult; - } catch (error) { + } catch (error, stackTrace) { throw DioError( requestOptions: _response.requestOptions, response: _response, type: DioErrorType.other, error: error, - ); + )..stackTrace = stackTrace; } return Response( @@ -137,7 +137,7 @@ class FakeApi { const _type = FullType(Pet); _bodyData = _serializers.serialize(pet, specifiedType: _type); - } catch(error) { + } catch(error, stackTrace) { throw DioError( requestOptions: _options.compose( _dio.options, @@ -146,7 +146,7 @@ class FakeApi { ), type: DioErrorType.other, error: error, - ); + )..stackTrace = stackTrace; } final _response = await _dio.request( @@ -196,7 +196,7 @@ class FakeApi { try { _bodyData = body; - } catch(error) { + } catch(error, stackTrace) { throw DioError( requestOptions: _options.compose( _dio.options, @@ -205,7 +205,7 @@ class FakeApi { ), type: DioErrorType.other, error: error, - ); + )..stackTrace = stackTrace; } final _response = await _dio.request( @@ -223,13 +223,13 @@ class FakeApi { try { _responseData = _response.data as bool; - } catch (error) { + } catch (error, stackTrace) { throw DioError( requestOptions: _response.requestOptions, response: _response, type: DioErrorType.other, error: error, - ); + )..stackTrace = stackTrace; } return Response( @@ -279,7 +279,7 @@ class FakeApi { const _type = FullType(OuterComposite); _bodyData = outerComposite == null ? null : _serializers.serialize(outerComposite, specifiedType: _type); - } catch(error) { + } catch(error, stackTrace) { throw DioError( requestOptions: _options.compose( _dio.options, @@ -288,7 +288,7 @@ class FakeApi { ), type: DioErrorType.other, error: error, - ); + )..stackTrace = stackTrace; } final _response = await _dio.request( @@ -310,13 +310,13 @@ class FakeApi { specifiedType: _responseType, ) as OuterComposite; - } catch (error) { + } catch (error, stackTrace) { throw DioError( requestOptions: _response.requestOptions, response: _response, type: DioErrorType.other, error: error, - ); + )..stackTrace = stackTrace; } return Response( @@ -365,7 +365,7 @@ class FakeApi { try { _bodyData = body; - } catch(error) { + } catch(error, stackTrace) { throw DioError( requestOptions: _options.compose( _dio.options, @@ -374,7 +374,7 @@ class FakeApi { ), type: DioErrorType.other, error: error, - ); + )..stackTrace = stackTrace; } final _response = await _dio.request( @@ -392,13 +392,13 @@ class FakeApi { try { _responseData = _response.data as num; - } catch (error) { + } catch (error, stackTrace) { throw DioError( requestOptions: _response.requestOptions, response: _response, type: DioErrorType.other, error: error, - ); + )..stackTrace = stackTrace; } return Response( @@ -447,7 +447,7 @@ class FakeApi { try { _bodyData = body; - } catch(error) { + } catch(error, stackTrace) { throw DioError( requestOptions: _options.compose( _dio.options, @@ -456,7 +456,7 @@ class FakeApi { ), type: DioErrorType.other, error: error, - ); + )..stackTrace = stackTrace; } final _response = await _dio.request( @@ -474,13 +474,13 @@ class FakeApi { try { _responseData = _response.data as String; - } catch (error) { + } catch (error, stackTrace) { throw DioError( requestOptions: _response.requestOptions, response: _response, type: DioErrorType.other, error: error, - ); + )..stackTrace = stackTrace; } return Response( @@ -530,7 +530,7 @@ class FakeApi { const _type = FullType(OuterObjectWithEnumProperty); _bodyData = _serializers.serialize(outerObjectWithEnumProperty, specifiedType: _type); - } catch(error) { + } catch(error, stackTrace) { throw DioError( requestOptions: _options.compose( _dio.options, @@ -539,7 +539,7 @@ class FakeApi { ), type: DioErrorType.other, error: error, - ); + )..stackTrace = stackTrace; } final _response = await _dio.request( @@ -561,13 +561,13 @@ class FakeApi { specifiedType: _responseType, ) as OuterObjectWithEnumProperty; - } catch (error) { + } catch (error, stackTrace) { throw DioError( requestOptions: _response.requestOptions, response: _response, type: DioErrorType.other, error: error, - ); + )..stackTrace = stackTrace; } return Response( @@ -617,7 +617,7 @@ class FakeApi { const _type = FullType(FileSchemaTestClass); _bodyData = _serializers.serialize(fileSchemaTestClass, specifiedType: _type); - } catch(error) { + } catch(error, stackTrace) { throw DioError( requestOptions: _options.compose( _dio.options, @@ -626,7 +626,7 @@ class FakeApi { ), type: DioErrorType.other, error: error, - ); + )..stackTrace = stackTrace; } final _response = await _dio.request( @@ -679,7 +679,7 @@ class FakeApi { const _type = FullType(User); _bodyData = _serializers.serialize(user, specifiedType: _type); - } catch(error) { + } catch(error, stackTrace) { throw DioError( requestOptions: _options.compose( _dio.options, @@ -688,7 +688,7 @@ class FakeApi { ), type: DioErrorType.other, error: error, - ); + )..stackTrace = stackTrace; } final _response = await _dio.request( @@ -739,7 +739,7 @@ class FakeApi { const _type = FullType(ModelClient); _bodyData = _serializers.serialize(modelClient, specifiedType: _type); - } catch(error) { + } catch(error, stackTrace) { throw DioError( requestOptions: _options.compose( _dio.options, @@ -748,7 +748,7 @@ class FakeApi { ), type: DioErrorType.other, error: error, - ); + )..stackTrace = stackTrace; } final _response = await _dio.request( @@ -770,13 +770,13 @@ class FakeApi { specifiedType: _responseType, ) as ModelClient; - } catch (error) { + } catch (error, stackTrace) { throw DioError( requestOptions: _response.requestOptions, response: _response, type: DioErrorType.other, error: error, - ); + )..stackTrace = stackTrace; } return Response( @@ -858,7 +858,7 @@ class FakeApi { if (callback != null) r'callback': encodeFormParameter(_serializers, callback, const FullType(String)), }; - } catch(error) { + } catch(error, stackTrace) { throw DioError( requestOptions: _options.compose( _dio.options, @@ -867,7 +867,7 @@ class FakeApi { ), type: DioErrorType.other, error: error, - ); + )..stackTrace = stackTrace; } final _response = await _dio.request( @@ -933,7 +933,7 @@ class FakeApi { if (enumFormString != null) r'enum_form_string': encodeFormParameter(_serializers, enumFormString, const FullType(String)), }; - } catch(error) { + } catch(error, stackTrace) { throw DioError( requestOptions: _options.compose( _dio.options, @@ -942,7 +942,7 @@ class FakeApi { ), type: DioErrorType.other, error: error, - ); + )..stackTrace = stackTrace; } final _response = await _dio.request( @@ -1049,7 +1049,7 @@ class FakeApi { const _type = FullType(BuiltMap, [FullType(String), FullType(String)]); _bodyData = _serializers.serialize(requestBody, specifiedType: _type); - } catch(error) { + } catch(error, stackTrace) { throw DioError( requestOptions: _options.compose( _dio.options, @@ -1058,7 +1058,7 @@ class FakeApi { ), type: DioErrorType.other, error: error, - ); + )..stackTrace = stackTrace; } final _response = await _dio.request( @@ -1112,7 +1112,7 @@ class FakeApi { r'param2': encodeFormParameter(_serializers, param2, const FullType(String)), }; - } catch(error) { + } catch(error, stackTrace) { throw DioError( requestOptions: _options.compose( _dio.options, @@ -1121,7 +1121,7 @@ class FakeApi { ), type: DioErrorType.other, error: error, - ); + )..stackTrace = stackTrace; } final _response = await _dio.request( diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/api/fake_classname_tags123_api.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/api/fake_classname_tags123_api.dart index a2b5a816ba..e97d899d0b 100644 --- a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/api/fake_classname_tags123_api.dart +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/api/fake_classname_tags123_api.dart @@ -59,7 +59,7 @@ class FakeClassnameTags123Api { const _type = FullType(ModelClient); _bodyData = _serializers.serialize(modelClient, specifiedType: _type); - } catch(error) { + } catch(error, stackTrace) { throw DioError( requestOptions: _options.compose( _dio.options, @@ -68,7 +68,7 @@ class FakeClassnameTags123Api { ), type: DioErrorType.other, error: error, - ); + )..stackTrace = stackTrace; } final _response = await _dio.request( @@ -90,13 +90,13 @@ class FakeClassnameTags123Api { specifiedType: _responseType, ) as ModelClient; - } catch (error) { + } catch (error, stackTrace) { throw DioError( requestOptions: _response.requestOptions, response: _response, type: DioErrorType.other, error: error, - ); + )..stackTrace = stackTrace; } return Response( diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/api/pet_api.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/api/pet_api.dart index 8a684092fc..e3f1473c5b 100644 --- a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/api/pet_api.dart +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/api/pet_api.dart @@ -61,7 +61,7 @@ class PetApi { const _type = FullType(Pet); _bodyData = _serializers.serialize(pet, specifiedType: _type); - } catch(error) { + } catch(error, stackTrace) { throw DioError( requestOptions: _options.compose( _dio.options, @@ -70,7 +70,7 @@ class PetApi { ), type: DioErrorType.other, error: error, - ); + )..stackTrace = stackTrace; } final _response = await _dio.request( @@ -185,13 +185,13 @@ class PetApi { specifiedType: _responseType, ) as BuiltList; - } catch (error) { + } catch (error, stackTrace) { throw DioError( requestOptions: _response.requestOptions, response: _response, type: DioErrorType.other, error: error, - ); + )..stackTrace = stackTrace; } return Response>( @@ -258,13 +258,13 @@ class PetApi { specifiedType: _responseType, ) as BuiltSet; - } catch (error) { + } catch (error, stackTrace) { throw DioError( requestOptions: _response.requestOptions, response: _response, type: DioErrorType.other, error: error, - ); + )..stackTrace = stackTrace; } return Response>( @@ -332,13 +332,13 @@ class PetApi { specifiedType: _responseType, ) as Pet; - } catch (error) { + } catch (error, stackTrace) { throw DioError( requestOptions: _response.requestOptions, response: _response, type: DioErrorType.other, error: error, - ); + )..stackTrace = stackTrace; } return Response( @@ -393,7 +393,7 @@ class PetApi { const _type = FullType(Pet); _bodyData = _serializers.serialize(pet, specifiedType: _type); - } catch(error) { + } catch(error, stackTrace) { throw DioError( requestOptions: _options.compose( _dio.options, @@ -402,7 +402,7 @@ class PetApi { ), type: DioErrorType.other, error: error, - ); + )..stackTrace = stackTrace; } final _response = await _dio.request( @@ -462,7 +462,7 @@ class PetApi { if (status != null) r'status': encodeFormParameter(_serializers, status, const FullType(String)), }; - } catch(error) { + } catch(error, stackTrace) { throw DioError( requestOptions: _options.compose( _dio.options, @@ -471,7 +471,7 @@ class PetApi { ), type: DioErrorType.other, error: error, - ); + )..stackTrace = stackTrace; } final _response = await _dio.request( @@ -531,7 +531,7 @@ class PetApi { if (file != null) r'file': MultipartFile.fromBytes(file, filename: r'file'), }); - } catch(error) { + } catch(error, stackTrace) { throw DioError( requestOptions: _options.compose( _dio.options, @@ -540,7 +540,7 @@ class PetApi { ), type: DioErrorType.other, error: error, - ); + )..stackTrace = stackTrace; } final _response = await _dio.request( @@ -562,13 +562,13 @@ class PetApi { specifiedType: _responseType, ) as ApiResponse; - } catch (error) { + } catch (error, stackTrace) { throw DioError( requestOptions: _response.requestOptions, response: _response, type: DioErrorType.other, error: error, - ); + )..stackTrace = stackTrace; } return Response( @@ -627,7 +627,7 @@ class PetApi { r'requiredFile': MultipartFile.fromBytes(requiredFile, filename: r'requiredFile'), }); - } catch(error) { + } catch(error, stackTrace) { throw DioError( requestOptions: _options.compose( _dio.options, @@ -636,7 +636,7 @@ class PetApi { ), type: DioErrorType.other, error: error, - ); + )..stackTrace = stackTrace; } final _response = await _dio.request( @@ -658,13 +658,13 @@ class PetApi { specifiedType: _responseType, ) as ApiResponse; - } catch (error) { + } catch (error, stackTrace) { throw DioError( requestOptions: _response.requestOptions, response: _response, type: DioErrorType.other, error: error, - ); + )..stackTrace = stackTrace; } return Response( diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/api/store_api.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/api/store_api.dart index 3b77dd6260..66fccc40e4 100644 --- a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/api/store_api.dart +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/api/store_api.dart @@ -110,13 +110,13 @@ class StoreApi { specifiedType: _responseType, ) as BuiltMap; - } catch (error) { + } catch (error, stackTrace) { throw DioError( requestOptions: _response.requestOptions, response: _response, type: DioErrorType.other, error: error, - ); + )..stackTrace = stackTrace; } return Response>( @@ -177,13 +177,13 @@ class StoreApi { specifiedType: _responseType, ) as Order; - } catch (error) { + } catch (error, stackTrace) { throw DioError( requestOptions: _response.requestOptions, response: _response, type: DioErrorType.other, error: error, - ); + )..stackTrace = stackTrace; } return Response( @@ -233,7 +233,7 @@ class StoreApi { const _type = FullType(Order); _bodyData = _serializers.serialize(order, specifiedType: _type); - } catch(error) { + } catch(error, stackTrace) { throw DioError( requestOptions: _options.compose( _dio.options, @@ -242,7 +242,7 @@ class StoreApi { ), type: DioErrorType.other, error: error, - ); + )..stackTrace = stackTrace; } final _response = await _dio.request( @@ -264,13 +264,13 @@ class StoreApi { specifiedType: _responseType, ) as Order; - } catch (error) { + } catch (error, stackTrace) { throw DioError( requestOptions: _response.requestOptions, response: _response, type: DioErrorType.other, error: error, - ); + )..stackTrace = stackTrace; } return Response( diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/api/user_api.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/api/user_api.dart index ebfb06b1c9..d8f4221911 100644 --- a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/api/user_api.dart +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/api/user_api.dart @@ -53,7 +53,7 @@ class UserApi { const _type = FullType(User); _bodyData = _serializers.serialize(user, specifiedType: _type); - } catch(error) { + } catch(error, stackTrace) { throw DioError( requestOptions: _options.compose( _dio.options, @@ -62,7 +62,7 @@ class UserApi { ), type: DioErrorType.other, error: error, - ); + )..stackTrace = stackTrace; } final _response = await _dio.request( @@ -113,7 +113,7 @@ class UserApi { const _type = FullType(BuiltList, [FullType(User)]); _bodyData = _serializers.serialize(user, specifiedType: _type); - } catch(error) { + } catch(error, stackTrace) { throw DioError( requestOptions: _options.compose( _dio.options, @@ -122,7 +122,7 @@ class UserApi { ), type: DioErrorType.other, error: error, - ); + )..stackTrace = stackTrace; } final _response = await _dio.request( @@ -173,7 +173,7 @@ class UserApi { const _type = FullType(BuiltList, [FullType(User)]); _bodyData = _serializers.serialize(user, specifiedType: _type); - } catch(error) { + } catch(error, stackTrace) { throw DioError( requestOptions: _options.compose( _dio.options, @@ -182,7 +182,7 @@ class UserApi { ), type: DioErrorType.other, error: error, - ); + )..stackTrace = stackTrace; } final _response = await _dio.request( @@ -284,13 +284,13 @@ class UserApi { specifiedType: _responseType, ) as User; - } catch (error) { + } catch (error, stackTrace) { throw DioError( requestOptions: _response.requestOptions, response: _response, type: DioErrorType.other, error: error, - ); + )..stackTrace = stackTrace; } return Response( @@ -350,13 +350,13 @@ class UserApi { try { _responseData = _response.data as String; - } catch (error) { + } catch (error, stackTrace) { throw DioError( requestOptions: _response.requestOptions, response: _response, type: DioErrorType.other, error: error, - ); + )..stackTrace = stackTrace; } return Response( @@ -446,7 +446,7 @@ class UserApi { const _type = FullType(User); _bodyData = _serializers.serialize(user, specifiedType: _type); - } catch(error) { + } catch(error, stackTrace) { throw DioError( requestOptions: _options.compose( _dio.options, @@ -455,7 +455,7 @@ class UserApi { ), type: DioErrorType.other, error: error, - ); + )..stackTrace = stackTrace; } final _response = await _dio.request(