Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function formatError (error: GraphQLError): GraphQLFormattedError {
let code: string = _.get(error, 'extensions.code', 'Error')
let info: any
let level = Severity.Error
const originalError: any = error.originalError
if (isAxiosError(originalError)) {
code = `Request${originalError.code}`
} else if (isJoiValidationError(originalError)) {
code = 'JoiValidationError'
info = originalError.details
} else if (isSequelizeError(originalError)) {
code = originalError.name
if (isUniqueConstraintError(originalError)) {
info = originalError.fields
level = Severity.Warning
}
} else if (isApolloError(originalError)){
level = originalError.level || Severity.Warning
} else if (isError(originalError)) {