Class ArgsSyntaxException

All Implemented Interfaces:
Serializable, ArgsAccessor, MatchCountAccessor, org.refcodes.exception.ErrorCodeAccessor, org.refcodes.exception.Trap, org.refcodes.mixin.SourceAccessor<Term>
Direct Known Subclasses:
AmbiguousArgsException, ParseArgsException, SuperfluousArgsException, UnknownArgsException

public class ArgsSyntaxException extends CliException.CliArgsException implements org.refcodes.mixin.SourceAccessor<Term>, MatchCountAccessor
Thrown in case of a command line arguments mismatch regarding provided and expected args.
See Also:
  • Field Details

    • _source

      protected Term _source
    • _matchCount

      protected int _matchCount
  • Constructor Details

    • ArgsSyntaxException

      public ArgsSyntaxException(String aMessage, String[] aArgs, Term aSource)
      Parameters:
      aSource - The Term responsible for this exception (source).
    • ArgsSyntaxException

      public ArgsSyntaxException(String aMessage, String[] aArgs, Term aSource, String aErrorCode)
      Parameters:
      aSource - The Term responsible for this exception (source).
    • ArgsSyntaxException

      public ArgsSyntaxException(String aMessage, String[] aArgs, Term aSource, Throwable aCause)
      Parameters:
      aSource - The Term responsible for this exception (source).
    • ArgsSyntaxException

      public ArgsSyntaxException(String aMessage, String[] aArgs, Term aSource, Throwable aCause, String aErrorCode)
      Parameters:
      aSource - The Term responsible for this exception (source).
    • ArgsSyntaxException

      public ArgsSyntaxException(String[] aArgs, Term aSource, Throwable aCause)
      Parameters:
      aSource - The Term responsible for this exception (source).
    • ArgsSyntaxException

      public ArgsSyntaxException(String[] aArgs, Term aSource, Throwable aCause, String aErrorCode)
      Parameters:
      aSource - The Term responsible for this exception (source).
    • ArgsSyntaxException

      public ArgsSyntaxException(String aMessage, String[] aArgs)
    • ArgsSyntaxException

      public ArgsSyntaxException(String aMessage, String[] aArgs, String aErrorCode)
    • ArgsSyntaxException

      public ArgsSyntaxException(String aMessage, String[] aArgs, Throwable aCause)
    • ArgsSyntaxException

      public ArgsSyntaxException(String aMessage, String[] aArgs, Throwable aCause, String aErrorCode)
    • ArgsSyntaxException

      public ArgsSyntaxException(String[] aArgs, Throwable aCause)
    • ArgsSyntaxException

      public ArgsSyntaxException(String[] aArgs, Throwable aCause, String aErrorCode)
  • Method Details

    • getMatchCount

      public int getMatchCount()
      Determines the number of args being matched upon encountering this exception.
      Specified by:
      getMatchCount in interface MatchCountAccessor
      Returns:
      The number of args matching till this exception occurred.
    • getSource

      public Term getSource()
      Returns the Term responsible for this exception.
      Specified by:
      getSource in interface org.refcodes.mixin.SourceAccessor<Term>
      Returns:
      The Term where this exception occurred.
    • toHeuristicMessage

      public String toHeuristicMessage()
      Tries to determine the most likely cause of this exception by crawling the exception tree down the causes and suppressed exceptions and evaluating their Term source's Term.getMatchCount() argument match counts. Throwable.getSuppressed() exceptions, the cause Throwable.getCause() is at a CHILD level of THIS exception, the cause's suppressed exceptions are at the SAME level as the cause itself. A wrong idea of the hierarchy of exceptions has erroneously been implemented, this implementation got to corrected as described.
      Returns:
      The heuristic cause of this exception.
    • toRootMatchCause

      public ArgsSyntaxException toRootMatchCause()
      Determines the root cause of this exception with the same match count (getMatchCount()) as this exception.
      Returns:
      The actual root cause of this exception or this exception if no (more specific) root cause was determined.
    • getPatternArguments

      public Object[] getPatternArguments()
      Specified by:
      getPatternArguments in interface org.refcodes.exception.Trap
      Overrides:
      getPatternArguments in class CliException.CliArgsException