Class QException

java.lang.Object
java.lang.Throwable
java.lang.Exception
com.io7m.quarrel.core.QException
All Implemented Interfaces:
com.io7m.seltzer.api.SStructuredErrorExceptionType<String>, com.io7m.seltzer.api.SStructuredErrorType<String>, Serializable

public final class QException extends Exception implements com.io7m.seltzer.api.SStructuredErrorExceptionType<String>
The type of exceptions raised by the package.
See Also:
  • Constructor Details

    • QException

      public QException(String message, String inErrorCode, Map<String,String> inAttributes, Optional<String> inRemediatingAction, List<com.io7m.seltzer.api.SStructuredErrorType<String>> inExtraErrors)
      Construct an exception.
      Parameters:
      message - The message
      inErrorCode - The error code
      inAttributes - The error attributes
      inRemediatingAction - The remediating action, if any
      inExtraErrors - The extra errors, if any
    • QException

      public QException(String message, Throwable cause, String inErrorCode, Map<String,String> inAttributes, Optional<String> inRemediatingAction, List<com.io7m.seltzer.api.SStructuredErrorType<String>> inExtraErrors)
      Construct an exception.
      Parameters:
      message - The message
      cause - The cause
      inErrorCode - The error code
      inAttributes - The error attributes
      inRemediatingAction - The remediating action, if any
      inExtraErrors - The extra errors, if any
  • Method Details

    • adapt

      public static <C, T extends Exception & com.io7m.seltzer.api.SStructuredErrorExceptionType<C>> QException adapt(T exception, Function<C,String> errorCodeConverter)
      Adapt a generic exception to this exception type.
      Type Parameters:
      C - The type of error codes
      T - The type of base exceptions
      Parameters:
      exception - An exception
      errorCodeConverter - A converter from error codes to strings
      Returns:
      An exception
    • extraErrors

      public List<com.io7m.seltzer.api.SStructuredErrorType<String>> extraErrors()
      Returns:
      The extra errors
    • errorCode

      public String errorCode()
      Specified by:
      errorCode in interface com.io7m.seltzer.api.SStructuredErrorType<String>
    • attributes

      public Map<String,String> attributes()
      Specified by:
      attributes in interface com.io7m.seltzer.api.SStructuredErrorType<String>
    • remediatingAction

      public Optional<String> remediatingAction()
      Specified by:
      remediatingAction in interface com.io7m.seltzer.api.SStructuredErrorType<String>
    • exception

      public Optional<Throwable> exception()
      Specified by:
      exception in interface com.io7m.seltzer.api.SStructuredErrorType<String>