@@ -40,9 +40,9 @@ const UnknownError = createError('UnknownError', {
40
40
export const baseResolver = createResolver (
41
41
// incoming requests will pass through this resolver like a no-op
42
42
null ,
43
-
44
- /*
45
- Only mask outgoing errors that aren't already apollo-errors,
43
+
44
+ /*
45
+ Only mask outgoing errors that aren't already apollo-errors,
46
46
such as ORM errors etc
47
47
*/
48
48
(root , args , context , error ) => isInstance (error) ? error : new UnknownError ()
@@ -79,7 +79,7 @@ export const isAdminResolver = isAuthenticatedResolver.createResolver(
79
79
the client within the `errors` array in the response.
80
80
*/
81
81
if (! user .isAdmin ) throw new ForbiddenError ();
82
-
82
+
83
83
/*
84
84
Since we aren't returning anything from the
85
85
request resolver, the request will continue on
@@ -134,7 +134,7 @@ const banUser = isAdminResolver.createResolver(
134
134
For admin users, let's tell the user what actually broke
135
135
in the case of an unhandled exception
136
136
*/
137
-
137
+
138
138
if (! isInstance (error)) throw new ExposedError ({
139
139
// overload the message
140
140
message: error .message
@@ -175,7 +175,7 @@ Resolvers are provided a mutable context object that is shared between all resol
175
175
``` javascript
176
176
import express from ' express' ;
177
177
import bodyParser from ' body-parser' ;
178
- import { graphqlExpress } from ' graphql -server-express' ;
178
+ import { graphqlExpress } from ' apollo -server-express' ;
179
179
import { createExpressContext } from ' apollo-resolvers' ;
180
180
import { formatError as apolloFormatError , createError } from ' apollo-errors' ;
181
181
@@ -212,16 +212,16 @@ app.use((req, res, next) => {
212
212
213
213
app .post (' /graphql' , graphqlExpress ((req , res ) => {
214
214
const user = req .user ;
215
-
215
+
216
216
const models = {
217
217
User: new UserModel (user)
218
218
};
219
-
219
+
220
220
const context = createExpressContext ({
221
221
models,
222
222
user
223
223
}, res);
224
-
224
+
225
225
return {
226
226
schema,
227
227
formatError, // error formatting via apollo-errors
0 commit comments