11# Upgrade
22
33## Upgrade v0.9.x > v0.10.x
4- #### Breaking: default error formatting
4+ ### Breaking: default error formatting
55By default exceptions thrown in resolvers will be reported with generic message ` "Internal server error" ` .
66Only exceptions implementing interface ` GraphQL\Error\ClientAware ` and claiming themselves as ` safe ` will
77be reported with full error message.
@@ -26,18 +26,30 @@ GraphQL\Error\FormattedError::setInternalErrorMessage("Unexpected error");
2626** This change only affects default error reporting mechanism. If you set your own error formatter using
2727` ExecutionResult::setErrorFormatter() ` you won't be affected by this change.**
2828
29- If you are not happy with this change just set [ your own error
29+ If default formatting doesn't work for you - just set [ your own error
3030formatter] ( http://webonyx.github.io/graphql-php/error-handling/#custom-error-formatting ) .
3131
32- #### Deprecated: GraphQL\Utils moved to GraphQL\Utils\Utils
32+ ### Breaking: ` GraphQL\Error\UserError ` base class
33+ ` GraphQL\Error\UserError ` now extends ` \RuntimeException ` (previously it was extending
34+ ` GraphQL\Error\InvariantViolation ` ).
35+
36+ ** This may affect authors of derived libraries and those using custom error formatting.**
37+ If you were catching ` InvariantViolation ` anywhere in your code, you should also catch ` UserError ` now.
38+
39+ Same applies to ` instanceof ` checks.
40+
41+ ` UserError ` is thrown when library detects invalid input from client.
42+
43+
44+ ### Deprecated: ` GraphQL\Utils ` moved to ` GraphQL\Utils\Utils `
3345Old class still exists, but triggers deprecation warning when referenced.
3446
3547## Upgrade v0.7.x > v0.8.x
3648All of those changes apply to those who extends various parts of this library.
3749If you only use the library and don't try to extend it - everything should work without breaks.
3850
3951
40- #### Breaking: Custom directives handling
52+ ### Breaking: Custom directives handling
4153When passing custom directives to schema, default directives (like ` @skip ` and ` @include ` )
4254are not added to schema automatically anymore. If you need them - add them explicitly with
4355your other directives.
@@ -58,15 +70,15 @@ $schema = new Schema([
5870]);
5971```
6072
61- #### Breaking: Schema protected property and methods visibility
73+ ### Breaking: Schema protected property and methods visibility
6274Most of the ` protected ` properties and methods of ` GraphQL\Schema ` were changed to ` private ` .
6375Please use public interface instead.
6476
65- #### Breaking: Node kind constants
77+ ### Breaking: Node kind constants
6678Node kind constants were extracted from ` GraphQL\Language\AST\Node ` to
6779separate class ` GraphQL\Language\AST\NodeKind `
6880
69- #### Non-breaking: AST node classes renamed
81+ ### Non-breaking: AST node classes renamed
7082AST node classes were renamed to disambiguate with types. e.g.:
7183
7284```
7890Old names are still available via ` class_alias ` defined in ` src/deprecated.php ` .
7991This file is included automatically when using composer autoloading.
8092
81- #### Deprecations
93+ ### Deprecations
8294There are several deprecations which still work, but trigger ` E_USER_DEPRECATED ` when used.
8395
8496For example ` GraphQL\Executor\Executor::setDefaultResolveFn() ` is renamed to ` setDefaultResolver() `
@@ -89,7 +101,7 @@ but still works with old name.
89101There are a few new breaking changes in v0.7.0 that were added to the graphql-js reference implementation
90102with the spec of April2016
91103
92- #### 1. Context for resolver
104+ ### 1. Context for resolver
93105
94106You can now pass a custom context to the ` GraphQL::execute ` function that is available in all resolvers as 3rd argument.
95107This can for example be used to pass the current user etc.
@@ -147,7 +159,7 @@ function resolveMyField($object, array $args, $context, ResolveInfo $info){
147159}
148160```
149161
150- #### 2. Schema constructor signature
162+ ### 2. Schema constructor signature
151163
152164The signature of the Schema constructor now accepts an associative config array instead of positional arguments:
153165
@@ -165,7 +177,7 @@ $schema = new Schema([
165177]);
166178```
167179
168- #### 3. Types can be directly passed to schema
180+ ### 3. Types can be directly passed to schema
169181
170182There are edge cases when GraphQL cannot infer some types from your schema.
171183One example is when you define a field of interface type and object types implementing
0 commit comments