Fix error extensions cause stack overflow #719
This commit is contained in:
parent
cae0fe3f02
commit
4d0fdd9e0f
|
@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
|
|||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [3.0.7] 2021-11-23
|
||||
|
||||
- Fix error extensions cause stack overflow. [#719](https://github.com/async-graphql/async-graphql/issues/719)
|
||||
|
||||
## [3.0.6] 2021-11-19
|
||||
|
||||
- Custom directives. [Book](https://async-graphql.github.io/async-graphql/en/custom_directive.html)
|
||||
|
|
2
examples
2
examples
|
@ -1 +1 @@
|
|||
Subproject commit 49939003f9f0daf11a97522d7c3489d3beb85adb
|
||||
Subproject commit c4043062a12f17ef80373d84a67986e3a27f3421
|
|
@ -358,7 +358,7 @@ impl From<mime::FromStrError> for ParseRequestError {
|
|||
/// An error which can be extended into a `Error`.
|
||||
pub trait ErrorExtensions: Sized {
|
||||
/// Convert the error to a `Error`.
|
||||
fn extend(self) -> Error;
|
||||
fn extend(&self) -> Error;
|
||||
|
||||
/// Add extensions to the error, using a callback to make the extensions.
|
||||
fn extend_with<C>(self, cb: C) -> Error
|
||||
|
@ -386,15 +386,15 @@ pub trait ErrorExtensions: Sized {
|
|||
}
|
||||
|
||||
impl ErrorExtensions for Error {
|
||||
fn extend(self) -> Error {
|
||||
self
|
||||
fn extend(&self) -> Error {
|
||||
self.clone()
|
||||
}
|
||||
}
|
||||
|
||||
// implementing for &E instead of E gives the user the possibility to implement for E which does
|
||||
// not conflict with this implementation acting as a fallback.
|
||||
impl<E: Display> ErrorExtensions for &E {
|
||||
fn extend(self) -> Error {
|
||||
fn extend(&self) -> Error {
|
||||
Error {
|
||||
message: self.to_string(),
|
||||
source: None,
|
||||
|
|
Loading…
Reference in New Issue