Skip navigation links

Package org.apache.olingo.odata2.api.exception

Exception Classes used in the OData library as well as the implementing application

See: Description

Package org.apache.olingo.odata2.api.exception Description

Exception Classes used in the OData library as well as the implementing application

APPLICATION DEVELOPERS: Please use ODataApplicationException for custom exceptions.

Exception handling:
Inside the OData library an ExceptionMapper exists which can transform any exception into an OData error format. The ExceptionMapper behaves after the following algorithm:
1. The cause of the exception will be determined by looking into the stack trace.
1.1. If the cause is an ODataApplicationException meaning that somewhere in the stack an ODataApplicationException is found the ExceptionMapper will take the following information from the ApplicationException and transform it into an OData error: message text, Locale, Inner Error and Error Code. There will be no altering of information for the ODataApplicationException.
1.2. If no ODataApplicationException is found in the stack the cause can be three different types of exceptions: ODataHttpException, ODataMessageException or an uncaught RuntimeException.
The ExceptionMapper will process them in the following order: 1. ODataHttpException, 2. ODataMessageException, 3 Other Exceptions.
1.2.1. ODataHttpExceptions will be transformed as follows: If an error code is set it will be displayed. The HTTP status code will be derived from the ODataHttpException. The message text and its language depend on the AcceptLanguageHeaders. The first supported language which is found in the Headers will result in the language of the message and the response.
1.2.1. ODataMessageException will be transformed as follows: If an error code is set it will be displayed. The HTTP status code will be 500. The message text and its language depend on the AcceptLanguageHeaders. The first supported language which is found in the Headers will result in the language of the message and the response.
1.2.1 Runtime Exceptions will be transformed as follows: No error code will be set. HTTP status will be 500. Message text will be taken from the exception and the language for the response will be English as default.

Exception Hierarchy
ODataException
* ODataApplicationException
* ODataMessageException
** EdmException
** EntityProviderException
** ExceptionVisitExpression
** ODataHttpException
*** ODataConflictException
*** ODataForbiddenException
*** ODataMethodNotAllowedException
*** ODataNotAcceptableException
*** ODataNotImplementedException
*** ODataPreconditionFailedException
*** ODataPreconditionRequiredException
*** ODataServiceUnavailableException
*** ODataUnsupportedMediaTypeException
*** ODataNotFoundException
**** UriNotMatchingException
*** ODataBadRequestException
**** ExpressionParserException
**** UriSyntaxException

Skip navigation links

Copyright © 2013-2017 The Apache Software Foundation. All Rights Reserved.