Package com.emc.documentum.rest.error

# Class RestErrorBuilder

java.lang.Object
com.emc.documentum.rest.error.RestErrorBuilder

public class RestErrorBuilder extends Object
A builder to build the REST error from a generic exception.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `RestErrorBuilder(Throwable throwable)`
  Constructor

- ## Method Summary

  Modifier and Type
  Method
  Description
  `RestErrorBuilder`
  `args(Object... args)`
  Set the message arguments for the corresponding message of the REST error code
  `RestError`
  `build()`
  Build the REST error with locale
  `RestErrorBuilder`
  `code(String code)`
  Set the REST error code
  `RestErrorBuilder`
  `details(List<String> details)`
  Set the details for the REST error.
  `RestErrorBuilder`
  `id(String id)`
  Set id for the REST error
  `RestErrorBuilder`
  `locale(Locale locale)`
  Set the localization for error message.
  `RestErrorBuilder`
  `status(int status)`
  Set the HTTP status code

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

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

- ## Constructor Details

  - ### RestErrorBuilder

    public RestErrorBuilder(Throwable throwable)
    Constructor
    Parameters:
      `throwable` - exception during the operation

- ## Method Details

  - ### status

    public RestErrorBuilder status(int status)
    Set the HTTP status code
    Parameters:
      `status` - the HTTP status code for error response
    Returns:
      the builder itself

  - ### code

    public RestErrorBuilder code(String code)
    Set the REST error code
    Parameters:
      `code` - the REST error code
    Returns:
      the builder itself

  - ### args

    public RestErrorBuilder args(Object... args)
    Set the message arguments for the corresponding message of the REST error code
    Parameters:
      `args` - the message arguments
    Returns:
      the builder itself

  - ### details

    public RestErrorBuilder details(List<String> details)
    Set the details for the REST error. Details will be delimited by semicolon(;).
    Parameters:
      `details` - the details of the REST error.
    Returns:
      the builder itself

  - ### id

    public RestErrorBuilder id(String id)
    Set id for the REST error
    Parameters:
      `id` - the REST error message id
    Returns:
      this builder itself

  - ### locale

    public RestErrorBuilder locale(Locale locale)
    Set the localization for error message. The default locale will be got from RepositoryContextHolder or the OS default locale.
    Parameters:
      `locale` - the locale for the error message
    Returns:
      this builder itself

  - ### build

    public RestError build()
    Build the REST error with locale
    Returns:
      the REST error instance