tlsException static method

PixException tlsException(
  1. TlsException tlsException
)

Creates a new SicoobCertificateException based on a TlsException

Implementation

static PixException tlsException(TlsException tlsException) {
  final osErrorMessage = tlsException.osError?.message ?? '';
  if (osErrorMessage.contains('INCORRECT_PASSWORD')) {
    return SicoobCertificateException(
      error: 'the-certificate-password-is-incorrect',
      errorDescription: 'A Senha do certificado está incorreta',
    );
  } else if (osErrorMessage.contains('BAD_PKCS12_DATA')) {
    return SicoobCertificateException(
      error: 'invalid-certificate-file',
      errorDescription: 'O Arquivo do certificado e inválido',
    );
  } else {
    return SicoobUnknownException.unknownException(tlsException);
  }
}