org.apache.olingo.odata2.api.exception

## Class ODataApplicationException

- java.lang.Object
- - java.lang.Throwable
  - - java.lang.Exception
    - - org.apache.olingo.odata2.api.exception.ODataException
      - - org.apache.olingo.odata2.api.exception.ODataApplicationException

- All Implemented Interfaces:
    Serializable

      public class ODataApplicationException
      extends ODataException

  This class represents a translated application exception. Use this exception class to display custom exception messages.
  If a HTTP status is given this exception will result in the set status code like an HTTP exception.
  A set status code can be used to show a substatus to a HTTP status as described in the OData protocol specification.
  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ODataApplicationException(String message, Locale locale)` Since this is a translated application exception locale must not be null.
    `ODataApplicationException(String message, Locale locale, HttpStatusCodes status)` Since this is a translated application exception locale must not be null.
    `ODataApplicationException(String message, Locale locale, HttpStatusCodes status, String errorCode)` Since this is a translated application exception locale must not be null.
    `ODataApplicationException(String message, Locale locale, HttpStatusCodes status, String errorCode, Throwable e)` Since this is a translated application exception locale must not be null.
    `ODataApplicationException(String message, Locale locale, HttpStatusCodes status, Throwable e)` Since this is a translated application exception locale must not be null.
    `ODataApplicationException(String message, Locale locale, String errorCode, Throwable e)` Since this is a translated application exception locale must not be null.
    `ODataApplicationException(String message, Locale locale, Throwable e)` Since this is a translated application exception locale must not be null.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `String` | `getCode()` Default code is null
    `HttpStatusCodes` | `getHttpStatus()` Default HttpStatusCodes.INTERNAL_SERVER_ERROR
    `Locale` | `getLocale()`

    - ### Methods inherited from class org.apache.olingo.odata2.api.exception.ODataException

      `getApplicationExceptionCause, getHttpExceptionCause, getMessageExceptionCause, isCausedByApplicationException, isCausedByHttpException, isCausedByMessageException`

    - ### Methods inherited from class java.lang.Throwable

      `addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### ODataApplicationException

          public ODataApplicationException(String message,
                                           Locale locale)

      Since this is a translated application exception locale must not be null.
      Parameters:
        `message` -
        `locale` -

    - #### ODataApplicationException

          public ODataApplicationException(String message,
                                           Locale locale,
                                           HttpStatusCodes status)

      Since this is a translated application exception locale must not be null.
      The status code given will be displayed at the client.
      Parameters:
        `message` -
        `locale` -
        `status` -

    - #### ODataApplicationException

          public ODataApplicationException(String message,
                                           Locale locale,
                                           HttpStatusCodes status,
                                           String errorCode)

      Since this is a translated application exception locale must not be null.
      The status code given will be displayed at the client.
      The error code may be used as a substatus for the HTTP status code as described in the OData protocol specification.
      Parameters:
        `message` -
        `locale` -
        `status` -
        `errorCode` -

    - #### ODataApplicationException

          public ODataApplicationException(String message,
                                           Locale locale,
                                           HttpStatusCodes status,
                                           String errorCode,
                                           Throwable e)

      Since this is a translated application exception locale must not be null.
      The status code given will be displayed at the client.
      The error code may be used as a substatus for the HTTP status code as described in the OData protocol specification.
      Parameters:
        `message` -
        `locale` -
        `status` -
        `errorCode` -
        `e` -

    - #### ODataApplicationException

          public ODataApplicationException(String message,
                                           Locale locale,
                                           Throwable e)

      Since this is a translated application exception locale must not be null.
      Parameters:
        `message` -
        `locale` -
        `e` -

    - #### ODataApplicationException

          public ODataApplicationException(String message,
                                           Locale locale,
                                           HttpStatusCodes status,
                                           Throwable e)

      Since this is a translated application exception locale must not be null.
      The status code given will be displayed at the client.
      Parameters:
        `message` -
        `locale` -
        `status` -
        `e` -

    - #### ODataApplicationException

          public ODataApplicationException(String message,
                                           Locale locale,
                                           String errorCode,
                                           Throwable e)

      Since this is a translated application exception locale must not be null.
      The error code may be used as a substatus for the HTTP status code as described in the OData protocol specification.
      Parameters:
        `message` -
        `locale` -
        `errorCode` -
        `e` -

  - ### Method Detail

    - #### getLocale

          public Locale getLocale()

      Returns:
        `Locale` the locale

    - #### getHttpStatus

          public HttpStatusCodes getHttpStatus()

      Default HttpStatusCodes.INTERNAL_SERVER_ERROR
      Returns:
        `HttpStatusCodes` the status code

    - #### getCode

          public String getCode()

      Default code is null
      Returns:
        StringThe error code displayed in the error message.

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