@keepfy/error-extractor
Advanced tools
Comparing version 1.2.7 to 1.3.0
@@ -7,3 +7,3 @@ import { AllErrorTypes, ApolloErrorWithProps, BackendErrorsWithProperties, ExtractMessageFromError, GraphQLError } from './types'; | ||
export declare const fromResponse: ({ graphQLErrors, networkError }: ErrorResponse) => AllErrorTypes; | ||
export declare const extractGQLProperties: <T extends "ENTITY_IS_STILL_REFERENCED">(error: Pick<GraphQLError, "properties">) => BackendErrorsWithProperties[T]; | ||
export declare const extractProperties: <T extends "ENTITY_IS_STILL_REFERENCED">(error: Pick<ErrorResponse, "graphQLErrors">) => BackendErrorsWithProperties[T]; | ||
export declare const extractGQLProperties: <T extends "ENTITY_IS_STILL_REFERENCED" | "DUPLICATED_ENTITY">(error: Pick<GraphQLError, "properties">) => BackendErrorsWithProperties[T]; | ||
export declare const extractProperties: <T extends "ENTITY_IS_STILL_REFERENCED" | "DUPLICATED_ENTITY">(error: Pick<ErrorResponse, "graphQLErrors">) => BackendErrorsWithProperties[T]; |
@@ -63,2 +63,6 @@ import { SuggestionsMap } from './types'; | ||
title: string; | ||
} | { | ||
message: any; | ||
type: "DUPLICATED_ENTITY"; | ||
title: string; | ||
}; |
@@ -28,5 +28,8 @@ import { fromGraphQLError } from './error'; | ||
type: 'BUSINESS_ERROR', | ||
title: 'Erro desconhecido', | ||
message: 'Erro não identificado, contate o administrador' | ||
...unknownError | ||
}, | ||
INTERNAL_SERVER_ERROR: { | ||
type: 'INTERNAL_SERVER_ERROR', | ||
...unknownError | ||
}, | ||
EMAIL_NOT_CONFIRMED: { | ||
@@ -62,6 +65,2 @@ type: 'EMAIL_NOT_CONFIRMED', | ||
}, | ||
INTERNAL_SERVER_ERROR: { | ||
type: 'INTERNAL_SERVER_ERROR', | ||
...unknownError | ||
}, | ||
INVALID_INPUT: { | ||
@@ -79,4 +78,12 @@ type: 'INVALID_INPUT', | ||
type: 'ENTITY_IS_STILL_REFERENCED', | ||
title: 'Entidade referênciada', | ||
title: 'Entidade referenciada', | ||
message: 'Não é possivel realizar a operação, entidade ainda possui vínculos' | ||
}, | ||
DUPLICATED_ENTITY: { | ||
type: 'DUPLICATED_ENTITY', | ||
title: 'Entidade duplicada', | ||
message: [ | ||
'Um ou mais campos únicos informados', | ||
'já estão cadastrados no sistema' | ||
].join(' ') | ||
} | ||
@@ -83,0 +90,0 @@ }; |
@@ -12,2 +12,7 @@ import { ErrorResponse } from 'apollo-link-error'; | ||
}; | ||
DUPLICATED_ENTITY: { | ||
keys: { | ||
[key: string]: string; | ||
}; | ||
}; | ||
}; | ||
@@ -14,0 +19,0 @@ export declare type BackEndErrorTypes = 'AUTHENTICATION_FAILED' | 'FORBIDDEN' | 'INVALID_SESSION' | 'INVALID_SUBSCRIPTION' | 'ENTITY_NOT_FOUND' | 'INVALID_INPUT' | 'INTERNAL_SERVER_ERROR' | 'BUSINESS_ERROR' | keyof BackendErrorsWithProperties; |
{ | ||
"name": "@keepfy/error-extractor", | ||
"version": "1.2.7", | ||
"version": "1.3.0", | ||
"description": "An error extractor package for keepfy frontend apps", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
17120
404