Class ErrorDetail<SelfT extends ErrorDetail<SelfT>>

  • All Implemented Interfaces:

    public abstract class ErrorDetail<SelfT extends ErrorDetail<SelfT>>
    extends Object
    implements Serializable
    Details about a single Guice error and supports formatting itself in the context of other Guice errors.

    WARNING: The class and its APIs are still experimental and subject to change.

    See Also:
    Serialized Form
    • Method Detail

      • isMergeable

        public boolean isMergeable​(ErrorDetail<?> otherError)
        Returns true if this error can be merged with the otherError and formatted together.

        By default this return false and implementations that support merging with other errors should override this method.

      • format

        public final void format​(int index,
                                 List<ErrorDetail<?>> mergeableErrors,
                                 Formatter formatter)
        Formats this error along with other errors that are mergeable with this error.

        mergeableErrors is a list that contains all other errors that are reported in the same exception that are considered to be mergable with this error base on result of calling isMergeable(<?>). The list will be empty if non of the other errors are mergable with this error.

        Formatted error has the following structure:

        • Summary of the error
        • Details about the error such as the source of the error
        • Hints for fixing the error if available
        • Link to the documentation on this error in greater detail
        index - index for this error
        mergeableErrors - list of errors that are mergeable with this error
        formatter - for printing the error message
      • getLearnMoreLink

        protected Optional<String> getLearnMoreLink()
        Returns an optional link to additional documentation about this error to be included in the formatted error message.
      • getErrorIdentifier

        protected Optional<String> getErrorIdentifier()
        Returns an optional string identifier for this error.
      • getMessage

        public String getMessage()
      • hashCode

        public int hashCode()
        hashCode in class Object
      • withSources

        public abstract SelfT withSources​(List<Object> newSources)
        Returns a new instance of the same ErrorDetail with updated sources.