mirror of
https://github.com/dadosfera/maestro.git
synced 2026-11-09 07:29:07 +00:00
FEAT: Connection test creating connection
- If any error occurs, connection is deleted - If operation_result is false, connection is deleted
This commit is contained in:
@@ -171,6 +171,31 @@ export function EnrichErrorCode(code: string) {
|
||||
message: 'Id encontra-se num formato inválido',
|
||||
code,
|
||||
};
|
||||
case ErrorCodes.CONNECTION_TEST.ERROR:
|
||||
return {
|
||||
statusCode: HttpStatus.BAD_REQUEST,
|
||||
error: 'Erro ao realizar o teste',
|
||||
message: 'Verifique os dados de conexão e tente novamente',
|
||||
code,
|
||||
};
|
||||
|
||||
case ErrorCodes.CONNECTION_TEST.EXPIRED:
|
||||
return {
|
||||
statusCode: HttpStatus.NOT_FOUND,
|
||||
error: 'Teste de conexão expirado',
|
||||
message: 'Favor realizar novo teste',
|
||||
code,
|
||||
};
|
||||
|
||||
case ErrorCodes.CONNECTION_TEST.TIMEOUT:
|
||||
return {
|
||||
statusCode: HttpStatus.INTERNAL_SERVER_ERROR,
|
||||
error: 'Tempo limite excedido',
|
||||
message:
|
||||
'O teste excedeu o tempo limite. Verifique os dados de conexão e tente novamente',
|
||||
code,
|
||||
};
|
||||
|
||||
case ErrorCodes.INTERNAL:
|
||||
case ErrorCodes.UNKNOWN:
|
||||
default:
|
||||
@@ -193,7 +218,7 @@ export default class ErrorBuilder extends HttpException {
|
||||
constructor(code: string | RpcException = '') {
|
||||
if (typeof code !== 'string') {
|
||||
logger.log(code?.stack);
|
||||
code = (code as any).details as string;
|
||||
code = (code as any)?.details as string;
|
||||
} else {
|
||||
logger.log(code);
|
||||
}
|
||||
|
||||
@@ -38,6 +38,13 @@ const TERMS_OF_USE = {
|
||||
REQUIRED: 'TERMS_OF_USE.REQUIRED',
|
||||
};
|
||||
|
||||
const CONNECTION_TEST = {
|
||||
ERROR: 'CONNECTION_TEST.ERROR',
|
||||
EXPIRED: 'CONNECTION_TEST.EXPIRED',
|
||||
TIMEOUT: 'CONNECTION_TEST.TIMEOUT',
|
||||
UNKNOWN: 'CONNECTION_TEST.UNKNOWN',
|
||||
};
|
||||
|
||||
const ErrorCodes = {
|
||||
UNKNOWN: 'UNKNOWN',
|
||||
RATE_LIMIT: 'RATE_LIMIT',
|
||||
@@ -47,6 +54,7 @@ const ErrorCodes = {
|
||||
TERMS_OF_USE,
|
||||
USER,
|
||||
CUSTOMER,
|
||||
CONNECTION_TEST,
|
||||
};
|
||||
|
||||
export default ErrorCodes;
|
||||
|
||||
Reference in New Issue
Block a user