@keepfy/error-extractor
Advanced tools
Comparing version 1.3.3 to 1.3.4
@@ -37,2 +37,6 @@ "use strict"; | ||
} | ||
// eslint-disable-next-line max-len | ||
if (message.includes('Não é possível finalizar uma solicitação de serviço se ela possui uma ordem de serviço aberta')) { | ||
return 'CANNOT_FINISH_REQUEST_WITH_ORDER'; | ||
} | ||
return 'UNKNOWN_ERROR'; | ||
@@ -49,3 +53,3 @@ }; | ||
// Fallback to message include calls | ||
if (fallbackTypes.includes(error.code)) { | ||
if (fallbackTypes.find(code => code === error.code)) { | ||
const properties = error.properties; | ||
@@ -52,0 +56,0 @@ const message = properties && properties.message |
@@ -1,71 +0,39 @@ | ||
import { SuggestionsMap } from './types'; | ||
import { GraphQLError, SuggestionsMap } from './types'; | ||
export declare const getSuggestion: <T extends import("./types").AllErrorTypes = import("./types").AllErrorTypes>(code: T) => SuggestionsMap[T]; | ||
export declare const suggestionFromGraphQLError: (graphQLErrors: readonly any[]) => { | ||
message: any; | ||
export declare const suggestionFromGraphQLError: (graphQLErrors: readonly GraphQLError[]) => (import("./types").MessageSuggestion & { | ||
type: "SERVICE_OFFLINE"; | ||
title: string; | ||
} | { | ||
message: any; | ||
}) | (import("./types").MessageSuggestion & { | ||
type: "CONNECTION_FAILED"; | ||
title: string; | ||
} | { | ||
message: any; | ||
}) | (import("./types").MessageSuggestion & { | ||
type: "UNKNOWN_ERROR"; | ||
title: string; | ||
} | { | ||
message: any; | ||
}) | (import("./types").MessageSuggestion & { | ||
type: "EMAIL_NOT_CONFIRMED"; | ||
title: string; | ||
} | { | ||
message: any; | ||
}) | (import("./types").MessageSuggestion & { | ||
type: "EMAIL_ALREADY_EXISTS"; | ||
title: string; | ||
} | { | ||
message: any; | ||
}) | (import("./types").MessageSuggestion & { | ||
type: "SCHEMA_UNKNOWN_FIELD"; | ||
title: string; | ||
} | { | ||
message: any; | ||
}) | (import("./types").MessageSuggestion & { | ||
type: "CANNOT_FINISH_REQUEST_WITH_ORDER"; | ||
}) | (import("./types").MessageSuggestion & { | ||
type: "AUTHENTICATION_FAILED"; | ||
title: string; | ||
} | { | ||
message: any; | ||
}) | (import("./types").MessageSuggestion & { | ||
type: "FORBIDDEN"; | ||
title: string; | ||
} | { | ||
message: any; | ||
}) | (import("./types").MessageSuggestion & { | ||
type: "INVALID_SESSION"; | ||
title: string; | ||
} | { | ||
message: any; | ||
}) | (import("./types").MessageSuggestion & { | ||
type: "INVALID_SUBSCRIPTION"; | ||
title: string; | ||
} | { | ||
message: any; | ||
}) | (import("./types").MessageSuggestion & { | ||
type: "ENTITY_NOT_FOUND"; | ||
title: string; | ||
} | { | ||
message: any; | ||
}) | (import("./types").MessageSuggestion & { | ||
type: "INVALID_INPUT"; | ||
title: string; | ||
} | { | ||
message: any; | ||
}) | (import("./types").MessageSuggestion & { | ||
type: "INTERNAL_SERVER_ERROR"; | ||
title: string; | ||
} | { | ||
message: any; | ||
}) | (import("./types").MessageSuggestion & { | ||
type: "EMPLOYEE_INACTIVE_ON_CURRENT_BRANCH"; | ||
title: string; | ||
} | { | ||
message: any; | ||
}) | (import("./types").MessageSuggestion & { | ||
type: "BUSINESS_ERROR"; | ||
title: string; | ||
} | { | ||
message: any; | ||
}) | (import("./types").MessageSuggestion & { | ||
type: "ENTITY_IS_STILL_REFERENCED"; | ||
title: string; | ||
} | { | ||
message: any; | ||
}) | (import("./types").MessageSuggestion & { | ||
type: "DUPLICATED_ENTITY"; | ||
title: string; | ||
}; | ||
}); |
@@ -80,2 +80,10 @@ "use strict"; | ||
}, | ||
CANNOT_FINISH_REQUEST_WITH_ORDER: { | ||
type: 'CANNOT_FINISH_REQUEST_WITH_ORDER', | ||
title: 'O.S. vinculada pendente', | ||
message: [ | ||
'Não é possível finalizar uma solicitação de', | ||
'serviço se ela possui uma ordem de serviço aberta' | ||
].join(' ') | ||
}, | ||
EMPLOYEE_INACTIVE_ON_CURRENT_BRANCH: { | ||
@@ -82,0 +90,0 @@ type: 'EMPLOYEE_INACTIVE_ON_CURRENT_BRANCH', |
import { ErrorResponse } from 'apollo-link-error'; | ||
import { ApolloError } from 'apollo-client'; | ||
export declare type ClientErrorTypes = 'SERVICE_OFFLINE' | 'CONNECTION_FAILED' | 'UNKNOWN_ERROR' | 'EMAIL_NOT_CONFIRMED' | 'EMAIL_ALREADY_EXISTS' | 'SCHEMA_UNKNOWN_FIELD'; | ||
export declare type ClientErrorTypes = 'SERVICE_OFFLINE' | 'CONNECTION_FAILED' | 'UNKNOWN_ERROR' | 'EMAIL_NOT_CONFIRMED' | 'EMAIL_ALREADY_EXISTS' | 'SCHEMA_UNKNOWN_FIELD' | 'CANNOT_FINISH_REQUEST_WITH_ORDER'; | ||
export declare type BackendErrorsWithProperties = { | ||
@@ -31,3 +31,3 @@ ENTITY_IS_STILL_REFERENCED: { | ||
export declare type GraphQLError = { | ||
code: BackEndErrorTypes; | ||
code: string; | ||
message: string; | ||
@@ -37,5 +37,4 @@ path: string[]; | ||
}; | ||
export declare type RawGraphQLError = ApolloError['graphQLErrors'][number]; | ||
export declare type ApolloErrorWithProps = Omit<ApolloError, 'graphQLErrors'> & { | ||
graphQLErrors: ReadonlyArray<RawGraphQLError & { | ||
graphQLErrors: ReadonlyArray<GraphQLError & { | ||
properties: unknown; | ||
@@ -42,0 +41,0 @@ }>; |
{ | ||
"name": "@keepfy/error-extractor", | ||
"version": "1.3.3", | ||
"version": "1.3.4", | ||
"description": "An error extractor package for keepfy frontend apps", | ||
@@ -15,5 +15,5 @@ "main": "lib/index.js", | ||
"scripts": { | ||
"build": "rm -rf ./lib/* && yarn lint && tsc", | ||
"build": "tsc", | ||
"lint": "eslint 'src/**/*.ts?(x)'", | ||
"prepare": "yarn build" | ||
"prepare": "rm -rf ./lib/* && yarn lint && yarn build" | ||
}, | ||
@@ -20,0 +20,0 @@ "peerDependencies": { |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
19256
13
0
405