Skip to content

Commit

Permalink
[dart][dart-dio-next] Add stacktraces to manual DioError instances (O…
Browse files Browse the repository at this point in the history
  • Loading branch information
kuhnroyal authored May 24, 2021
1 parent 48924eb commit be84c44
Show file tree
Hide file tree
Showing 8 changed files with 94 additions and 94 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -85,7 +85,7 @@ class {{classname}} {
),
type: DioErrorType.other,
error: error,
);
)..stackTrace = stackTrace;
}
{{/hasBodyOrFormParams}}

Expand All @@ -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}}}>(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -61,7 +61,7 @@ class AnotherFakeApi {
),
type: DioErrorType.other,
error: error,
);
)..stackTrace = stackTrace;
}

final _response = await _dio.request<Object>(
Expand All @@ -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<ModelClient>(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<InlineResponseDefault>(
Expand Down
Loading

0 comments on commit be84c44

Please sign in to comment.