private String getMessageText(final Throwable throwable) { return throwable instanceof ODataMessageException ? MessageService.getMessage(locale, ((ODataMessageException) throwable).getMessageReference()).getText() : throwable.getLocalizedMessage() == null ? "Exception text missing" : throwable.getLocalizedMessage(); } }
private String getMessageText(final Throwable throwable) { return throwable instanceof ODataMessageException ? MessageService.getMessage(locale, ((ODataMessageException) throwable).getMessageReference()).getText() : throwable.getLocalizedMessage() == null ? "Exception text missing" : throwable.getLocalizedMessage(); } }
@Override public String extractExceptionMessage(final ODataMessageException exception) { Message msg = MessageService.getMessage(Locale.ENGLISH, exception.getMessageReference()); return msg.getText(); } }
@Override public String extractExceptionMessage(final ODataMessageException exception) { Message msg = MessageService.getMessage(Locale.ENGLISH, exception.getMessageReference()); return msg.getText(); } }
"message", throwable instanceof ODataMessageException ? MessageService.getMessage(locale, ((ODataMessageException) throwable).getMessageReference()) .getText() : throwable.getLocalizedMessage())
private void enhanceContextWithMessageException(final ODataMessageException toHandleException) { errorContext.setErrorCode(toHandleException.getErrorCode()); MessageReference messageReference = toHandleException.getMessageReference(); Message localizedMessage = messageReference == null ? null : extractEntity(messageReference); if (localizedMessage != null) { errorContext.setMessage(localizedMessage.getText()); errorContext.setLocale(localizedMessage.getLocale()); } if (toHandleException instanceof ODataHttpException) { errorContext.setHttpStatus(((ODataHttpException) toHandleException).getHttpStatus()); } else if (toHandleException instanceof EntityProviderException) { errorContext.setHttpStatus(HttpStatusCodes.BAD_REQUEST); } else if (toHandleException instanceof BatchException) { errorContext.setHttpStatus(HttpStatusCodes.BAD_REQUEST); } }
private void enhanceContextWithMessageException(final ODataMessageException toHandleException) { errorContext.setErrorCode(toHandleException.getErrorCode()); MessageReference messageReference = toHandleException.getMessageReference(); Message localizedMessage = messageReference == null ? null : extractEntity(messageReference); if (localizedMessage != null) { errorContext.setMessage(localizedMessage.getText()); errorContext.setLocale(localizedMessage.getLocale()); } if (toHandleException instanceof ODataHttpException) { errorContext.setHttpStatus(((ODataHttpException) toHandleException).getHttpStatus()); } else if (toHandleException instanceof EntityProviderException) { if(toHandleException instanceof EntityProviderProducerException){ /* * As per OLINGO-763 serializer exceptions are produced by the server and must therefore result * in a 500 internal server error */ errorContext.setHttpStatus(HttpStatusCodes.INTERNAL_SERVER_ERROR); }else{ errorContext.setHttpStatus(HttpStatusCodes.BAD_REQUEST); } } else if (toHandleException instanceof BatchException) { errorContext.setHttpStatus(HttpStatusCodes.BAD_REQUEST); } }
private void enhanceContextWithMessageException(final ODataMessageException toHandleException) { errorContext.setErrorCode(toHandleException.getErrorCode()); MessageReference messageReference = toHandleException.getMessageReference(); Message localizedMessage = messageReference == null ? null : extractEntity(messageReference); if (localizedMessage != null) { errorContext.setMessage(localizedMessage.getText()); errorContext.setLocale(localizedMessage.getLocale()); } if (toHandleException instanceof ODataHttpException) { errorContext.setHttpStatus(((ODataHttpException) toHandleException).getHttpStatus()); } else if (toHandleException instanceof EntityProviderException) { if(toHandleException instanceof EntityProviderProducerException){ /* * As per OLINGO-763 serializer exceptions are produced by the server and must therefore result * in a 500 internal server error */ errorContext.setHttpStatus(HttpStatusCodes.INTERNAL_SERVER_ERROR); }else{ errorContext.setHttpStatus(HttpStatusCodes.BAD_REQUEST); } } else if (toHandleException instanceof BatchException) { errorContext.setHttpStatus(HttpStatusCodes.BAD_REQUEST); } }
private void enhanceContextWithMessageException(final ODataMessageException toHandleException) { errorContext.setErrorCode(toHandleException.getErrorCode()); MessageReference messageReference = toHandleException.getMessageReference(); Message localizedMessage = messageReference == null ? null : extractEntity(messageReference); if (localizedMessage != null) { errorContext.setMessage(localizedMessage.getText()); errorContext.setLocale(localizedMessage.getLocale()); } if (toHandleException instanceof ODataHttpException) { errorContext.setHttpStatus(((ODataHttpException) toHandleException).getHttpStatus()); } else if (toHandleException instanceof EntityProviderException) { if(toHandleException instanceof EntityProviderProducerException){ /* * As per OLINGO-763 serializer exceptions are produced by the server and must therefore result * in a 500 internal server error */ errorContext.setHttpStatus(HttpStatusCodes.INTERNAL_SERVER_ERROR); }else{ errorContext.setHttpStatus(HttpStatusCodes.BAD_REQUEST); } } else if (toHandleException instanceof BatchException) { errorContext.setHttpStatus(HttpStatusCodes.BAD_REQUEST); } }
private void enhanceContextWithMessageException(final ODataMessageException toHandleException) { errorContext.setErrorCode(toHandleException.getErrorCode()); MessageReference messageReference = toHandleException.getMessageReference(); Message localizedMessage = messageReference == null ? null : extractEntity(messageReference); if (localizedMessage != null) { errorContext.setMessage(localizedMessage.getText()); errorContext.setLocale(localizedMessage.getLocale()); } if (toHandleException instanceof ODataHttpException) { errorContext.setHttpStatus(((ODataHttpException) toHandleException).getHttpStatus()); } else if (toHandleException instanceof EntityProviderException) { if(toHandleException instanceof EntityProviderProducerException){ /* * As per OLINGO-763 serializer exceptions are produced by the server and must therefore result * in a 500 internal server error */ errorContext.setHttpStatus(HttpStatusCodes.INTERNAL_SERVER_ERROR); }else{ errorContext.setHttpStatus(HttpStatusCodes.BAD_REQUEST); } } else if (toHandleException instanceof BatchException) { errorContext.setHttpStatus(HttpStatusCodes.BAD_REQUEST); } }