Package com.orchestranetworks.rest

# Class LocalizedException

java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
jakarta.ws.rs.WebApplicationException
com.orchestranetworks.rest.LocalizedException

All Implemented Interfaces:
  `Serializable`

Direct Known Subclasses:
  `AuthenticationException`, `UnprocessableEntityException`

public class LocalizedException extends WebApplicationException
Class that can be extended by exceptions that return a localized error message.

If thrown by REST services and not caught, they will be automatically transformed into an appropriate JAX-RS HTTP response and may be displayed to the end user.

Since:
  5.9.0
See Also:
  - Exception handling

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `LocalizedException(int aStatus, UserMessage aUserMessage)`
  `LocalizedException(int aStatus, UserMessage aUserMessage, Integer anErrorCode)`
  `LocalizedException(int aStatus, UserMessage aUserMessage, Integer anErrorCode, Throwable aCause)`
  Constructs a new instance with the provided data.
  `LocalizedException(int aStatus, UserMessage aUserMessage, Throwable aCause)`
  Constructs a new instance with the provided data, without functional error code.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `final Integer`
  `getErrorCode()`
  Returns the functional error code provided by the REST service.
  `final int`
  `getStatus()`
  Returns the HTTP status code associated with the response.
  `final UserMessage`
  `getUserMessage()`
  Returns the user message that may be displayed to the end user as an error message.

  ### Methods inherited from class jakarta.ws.rs.WebApplicationException

  `getResponse`

  ### 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

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

- ## Constructor Details

  - ### LocalizedException

    public LocalizedException(int aStatus, UserMessage aUserMessage)
    See Also:
      - `LocalizedException(int, UserMessage, Throwable)`

  - ### LocalizedException

    public LocalizedException(int aStatus, UserMessage aUserMessage, Throwable aCause)
    Constructs a new instance with the provided data, without functional error code.
    Since:
      6.0.0
    See Also:
      - `LocalizedException(int, UserMessage, Integer, Throwable)`

  - ### LocalizedException

    public LocalizedException(int aStatus, UserMessage aUserMessage, Integer anErrorCode)
    See Also:
      - `LocalizedException(int, UserMessage, Integer, Throwable)`

  - ### LocalizedException

    public LocalizedException(int aStatus, UserMessage aUserMessage, Integer anErrorCode, Throwable aCause)
    Constructs a new instance with the provided data.
    Parameters:
      `aStatus` - the HTTP status code that will be returned to the client.
      `aUserMessage` - the localized message that may be displayed to the end user.
      `anErrorCode` - the functional error code.
      `aCause` - The underlying cause of this thrown exception

- ## Method Details

  - ### getErrorCode

    public final Integer getErrorCode()
    Returns the functional error code provided by the REST service.

    It may be `null`.

  - ### getStatus

    public final int getStatus()
    Returns the HTTP status code associated with the response.

  - ### getUserMessage

    public final UserMessage getUserMessage()
    Returns the user message that may be displayed to the end user as an error message.

    It may be `null`.