use of ch.cyberduck.core.ssl.SSLExceptionMappingService in project cyberduck by iterate-ch.
the class DefaultIOExceptionMappingService method map.
@Override
public BackgroundException map(final IOException failure) {
final Throwable[] stack = ExceptionUtils.getThrowables(failure);
for (Throwable t : stack) {
if (t instanceof BackgroundException) {
return (BackgroundException) t;
}
}
if (failure instanceof SSLException) {
return new SSLExceptionMappingService().map((SSLException) failure);
}
final StringBuilder buffer = new StringBuilder();
this.append(buffer, failure.getMessage());
for (Throwable cause : ExceptionUtils.getThrowableList(failure)) {
if (!StringUtils.contains(failure.getMessage(), cause.getMessage())) {
this.append(buffer, cause.getMessage());
}
}
return this.wrap(failure, buffer);
}
use of ch.cyberduck.core.ssl.SSLExceptionMappingService in project cyberduck by iterate-ch.
the class AzureExceptionMappingService method map.
@Override
public BackgroundException map(final StorageException failure) {
final StringBuilder buffer = new StringBuilder();
this.append(buffer, failure.getMessage());
if (ExceptionUtils.getRootCause(failure) instanceof UnknownHostException) {
return new NotfoundException(buffer.toString(), failure);
}
switch(failure.getHttpStatusCode()) {
case 403:
return new LoginFailureException(buffer.toString(), failure);
case 404:
return new NotfoundException(buffer.toString(), failure);
case 304:
case 405:
case 400:
case 411:
case 412:
return new InteroperabilityException(buffer.toString(), failure);
case 500:
// OperationTimedOut
return new ConnectionTimeoutException(buffer.toString(), failure);
case 503:
// ServerBusy
return new RetriableAccessDeniedException(buffer.toString(), failure);
}
for (Throwable cause : ExceptionUtils.getThrowableList(failure)) {
if (cause instanceof SSLException) {
return new SSLExceptionMappingService().map(buffer.toString(), (SSLException) cause);
}
}
return this.wrap(failure, buffer);
}
Aggregations