class SwiftExceptionMappingService extends AbstractExceptionMappingService<GenericException> {

    @Override
    public BackgroundException map(final GenericException e) {
        final StringBuilder buffer = new StringBuilder();
        this.append(buffer, e.getMessage());
        final StatusLine status = e.getHttpStatusLine();
        if(null != status) {
            this.append(buffer, String.format("%d %s", status.getStatusCode(), status.getReasonPhrase()));
        }
        switch(e.getHttpStatusCode()) {
            case HttpStatus.SC_BAD_REQUEST:
                return new LoginFailureException(buffer.toString(), e);
        }
        return new DefaultHttpResponseExceptionMappingService().map(new HttpResponseException(e.getHttpStatusCode(), buffer.toString()));
    }

}