com.google.web.bindery.requestfactory.shared

## Class ServerFailure

- java.lang.Object
- - com.google.web.bindery.requestfactory.shared.ServerFailure

-     public class ServerFailure
      extends java.lang.Object

  Describes a request failure on the server.

  This error reporting mechanism is adequate at best. When RequestFactory is extended to handle polymorphic types, this class will likely be replaced with something more expressive.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ServerFailure()` Constructs a ServerFailure with null properties.
    `ServerFailure(java.lang.String message)` Constructs a fatal ServerFailure with null type and null stack trace.
    `ServerFailure(java.lang.String message, java.lang.String exceptionType, java.lang.String stackTraceString, boolean fatal)` Constructs a ServerFailure object.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.lang.String` | `getExceptionType()` Return the exception type.
    `java.lang.String` | `getMessage()` Return the failure message.
    `RequestContext` | `getRequestContext()` Returns the RequestContext that triggered the ServerFailure.
    `java.lang.String` | `getStackTraceString()` Return the failure stack trace.
    `boolean` | `isFatal()` Return true if this is a fatal error.
    `void` | `setRequestContext(RequestContext requestContext)` Sets the RequestContext to return via `getRequestContext()`.

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

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

- - ### Constructor Detail

    - #### ServerFailure

          public ServerFailure()

      Constructs a ServerFailure with null properties.

    - #### ServerFailure

          public ServerFailure(java.lang.String message)

      Constructs a fatal ServerFailure with null type and null stack trace.

    - #### ServerFailure

          public ServerFailure(java.lang.String message,
                               java.lang.String exceptionType,
                               java.lang.String stackTraceString,
                               boolean fatal)

      Constructs a ServerFailure object.
      Parameters:
        `message` - a String containing the failure message
        `exceptionType` - a String containing the exception type
        `stackTraceString` - a String containing the stack trace

  - ### Method Detail

    - #### getExceptionType

          public java.lang.String getExceptionType()

      Return the exception type.
      Returns:
        the exception type as a String

    - #### getMessage

          public java.lang.String getMessage()

      Return the failure message.
      Returns:
        the message as a String

    - #### getRequestContext

          public RequestContext getRequestContext()

      Returns the RequestContext that triggered the ServerFailure.

    - #### getStackTraceString

          public java.lang.String getStackTraceString()

      Return the failure stack trace.
      Returns:
        the stack trace as a String

    - #### isFatal

          public boolean isFatal()

      Return true if this is a fatal error. The default implementation of `Receiver.onFailure(com.google.web.bindery.requestfactory.shared.ServerFailure)` throws a runtime exception for fatal failures.
      Returns:
        whether this is a fatal failure

    - #### setRequestContext

          public void setRequestContext(RequestContext requestContext)

      Sets the RequestContext to return via `getRequestContext()`.