Commit Graph

82 Commits

Author SHA1 Message Date
Sunli
93763997af Rework connection types 2022-04-19 19:18:06 +08:00
Sunli
c3b926dec6 Add ErrorExtensionValues::get method. #855 2022-03-14 09:48:27 +08:00
Sunli
7d68c49abb Remove 'static bound for impl From<T> for Error. 2022-01-24 10:56:47 +08:00
Sunli
db3706dafa Clippy 2021-12-30 10:16:49 +08:00
Sunli
f6fe15554d Fix error extensions cause stack overflow #719 2021-11-23 09:02:52 +08:00
Sunli
bb24498b6e Add ErrorExtensionValues::unset method. 2021-11-16 15:04:29 +08:00
Sunli
d9cd21802d Remove ResolverError and use Error::new_with_source instead. 2021-11-16 11:05:50 +08:00
Sunli
a26cc65d59 Rework Failure 3 #671 2021-11-07 19:11:43 +08:00
Sunli
490cfec5f5 Rework Failure2 #671 2021-11-05 19:05:49 +08:00
Sunli
d62aca8052 Rework Failure #671 2021-11-04 19:37:22 +08:00
Sunli
63544aab5b Fix tests 2021-11-04 14:54:26 +08:00
Sunli
e898998311 Add Failure type. #671 2021-11-04 14:33:04 +08:00
Erik Tesar
335e749429
fix: mark error types with Send and Sync 2021-09-02 13:35:34 +02:00
Erik Tesar
800eb4b10a
fix: ParseRequestError::InvalidFilesMap now is dyn std::error::Error 2021-09-02 12:21:34 +02:00
Erik Tesar
c1cc30d421
decide which decoder to use based on content-type 2021-07-31 14:52:56 +02:00
Miaxos
11c67e6cc3 misc: boxed error 2021-07-26 17:32:49 +00:00
cloudybyte
9fe4188196
try to add cbor support 2021-07-26 17:29:52 +02:00
Sunli
dfe8245894 Add support for returning multiple resolver errors. #531 2021-06-07 14:03:36 +08:00
Sunli
8310fa4350 Now all features are not activated by default. 2021-03-22 10:39:17 +08:00
Sunli
4d6fd5b539 Clippy clean 2021-01-11 09:01:28 +08:00
Sunli
20e5732525 Implements InputType for Box<T> and Arc<T>. #382 2021-01-10 13:48:18 +08:00
Sunli
03f6ed4ba2 Rename InputValueType to InputType and OutputValueType to OutputType. 2020-12-11 15:37:50 +08:00
Koxiaet
9d94c933ff Don't duplicate type names in parsing error message 2020-11-07 06:05:59 +00:00
Sunli
82333e49b9 Remove the validation of the content-type by the receive_batch_body function, because this is of little significance. #332 2020-11-01 11:31:54 +08:00
Sunli
055936f9ad Derive Serialize for Request and Deserialize for Response. 2020-10-23 08:26:48 +08:00
Koxiaet
2756c2cd5b Require JSON content-type 2020-10-15 18:30:16 +01:00
Sunli
03b276fe7e Fix a small bug. 2020-10-15 16:45:33 +08:00
Koxiaet
d34ac0ba08 Make imports consistent 2020-10-15 07:38:10 +01:00
Sunli
10cd868f4c Some improvements. 2020-10-10 16:28:07 +08:00
Aurelien Foucault
dff328a85c Add eq for errors 2020-10-08 15:32:37 +02:00
Sunli
e47360d1a2 Fix typo. #297 2020-10-04 07:49:56 +08:00
Sunli
e263c755e2 Restore the original error extension implementation. 2020-10-02 14:56:10 +08:00
Sunli
1e30712726 Merge branch 'master' into rework-errors 2020-10-01 09:39:47 +08:00
Sunli
fd4c2b193b Added Apollo persisted queries extension. #280 2020-09-30 11:37:12 +08:00
Koxiaet
2ddaaaa07f Rework errors
This completely overhauls the error system used in async-graphql.
- `Error` has been renamed to `ServerError` and `FieldError` has been
renamed to just `Error`. This is because `FieldError` is by far the most
common error that users will have to use so it makes sense to use the
most obvious error name. Also, the current name didn't make sense as it
was used for things other than field errors, such as the data callback
for websockets.
- `ServerError` has been made completely opaque. Before it was an enum
of all the possible errors, but now it just contains an error message,
the locations, the path and extensions. It is a shame that we lose
information, it makes more sense as _conceptually_ GraphQL does not
provide that information. It also frees us to change the internals of
async-graphql a lot more.
- The path of errors is no longer an opaque JSON value but a regular
type, `Vec<PathSegment>`. The type duplication of `PathSegment` and
`QueryPathSegment` is unfortunate, I plan to work on this in the future.
- Now that `ServerError` is opaque, `RuleError` has been removed from
the public API, making it simpler.
- Additionally `QueryError` has been completely removed. Instead the
error messages are constructed ad-hoc; I took care to never repeat an
error message.
- Instead of constructing field-not-found errors inside the
implementations of field resolvers they now return `Option`s, where a
`None` value is representative of the field not being found.
- As an unfortunate consequence of the last change, self-referential
types based on the output of a subscription resolver can no longer be
created. This does not mean anything for users, but causes lifetime
issues in the implementation of merged objects. I fixed it with a bit of
a hack, but this'll have to be looked into further.
- `InputValueError` now has a generic parameter - it's kind of weird but
it's necessary for ergonomics. It also improves error messages.
- The `ErrorExtensions` trait has been removed. I didn't think the
`extend` method was necessary since `From` impls exist. But the
ergonomics are still there with a new trait `ExtendError`, which
is implemented for both errors and results.
- `Response` now supports serializing multiple errors. This allows for
nice things like having multiple validation errors not be awkwardly
shoved into a single error.
- When an error occurs in execution, data is sent as `null`. This is
slightly more compliant with the spec but the algorithm described in
<https://spec.graphql.org/June2018/#sec-Errors-and-Non-Nullability> has
yet to be implemented.
2020-09-29 20:06:44 +01:00
Sunli
9333583483 Improve the error message of Tracing extension. 2020-09-26 12:35:28 +08:00
Koxiaet
0880be3e0b Move some validations to parser
This commit moves the single anonymous and duplicated operation name
validation rules into the parser, allowing for a nicer format to be
exposed by it. It also adds better error messages to the parser.
2020-09-22 19:59:48 +01:00
Koxiaet
3c04411780 Remove code duplication for batch requests 2020-09-17 19:43:03 +01:00
Sunli
dc77e7f262 Update docs 2020-09-17 09:03:36 +08:00
Koxiaet
f82322045e Document features 2020-09-15 19:32:13 +01:00
Koxiaet
a86c3a86b8 Remove and feature-gate dependencies 2020-09-14 19:38:41 +01:00
Sunli
7a90069cad Continue to refactor. 2020-09-10 16:39:43 +08:00
Koxiaet
e3e58d261d Rewrite async-graphql-parser 2020-09-06 06:38:31 +01:00
Sunli
d04b5b675f Fix the test code and add docs. 2020-09-01 09:10:12 +08:00
Koxiaet
945cd72869 Remove dependency on serde_derive, satisfy Clippy, improve docs 2020-08-31 19:18:02 +01:00
Sunli
c7c4de94ed Replace log crate with xlog. 2020-07-15 18:05:24 +08:00
Kevin Schoonover
80ff792f1a Add input validator tests + fix clippy errors 2020-06-01 16:42:13 -05:00
sunli
e949cb441c Add defer tests 2020-05-20 13:42:55 +08:00
Sunli
6cda0644c6 Upgrade multer to 1.1.1 2020-05-18 09:32:55 +08:00
sunli
44b1eb4fb4 Replace multipart parser with multer. 2020-05-17 16:26:36 +08:00