에 체크 아웃 : 자신 읽어에서 https://github.com/thebigredgeek/apollo-errors
는 :
는 약간의 오차가 만듭니다
import { createError } from 'apollo-errors';
export const FooError = createError('FooError', {
message: 'A foo error has occurred'
});
최대 후크 형식 :
import express from 'express';
import bodyParser from 'body-parser';
import { formatError } from 'apollo-errors';
import { graphqlExpress } from 'apollo-server-express';
import schema from './schema';
const app = express();
app.use('/graphql',
bodyParser.json(),
graphqlExpress({
formatError,
schema
})
);
app.listen(8080)
는 약간의 오차가 던져 :
를
import { FooError } from './errors';
const resolverThatThrowsError = (root, params, context) => {
throw new FooError({
data: {
something: 'important'
}
});
}
답변 해 주셔서 감사합니다. 1) 나는 문자열 배열로 에러 배열이나 에러 배열을 던지려고했으나 행운은 없었다. 어떻게하는지 아십니까? 2) 정상적인 루틴에서는 서버 응답의 오류 배열이 양식 유효성 검사와 같은 오류에는 적합하지 않은 것처럼 데이터 개체에 잡힌 오류를 대신 배치합니다. – James