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