Class SpecProgramException

  • All Implemented Interfaces:
    java.io.Serializable

    public class SpecProgramException
    extends java.lang.Exception
    Something went wrong while applying a specification file to some values
    Author:
    Raphael Mudge
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.lang.String message
      The message associated with the error.
      protected crystalpalace.spec.SpecProgram program
      The program where the error occurred.
    • Constructor Summary

      Constructors 
      Constructor Description
      SpecProgramException​(crystalpalace.spec.SpecProgram program, java.lang.String message)
      Construct a new program exception.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      crystalpalace.spec.SpecObject getArgument()
      Returns the argument to the was-executing command.
      java.lang.String getCommand()
      Returns the last command that was run or running when this error occured.
      java.lang.String getFile()
      Get the file associated with this program.
      java.lang.String getFileName()
      Get the shortname of the file where this error occured.
      java.lang.String getMessage()
      Get the description of the error that generated this exception.
      java.util.Stack getStack()
      Get the stack from the .spec file's execution environment.
      java.lang.String getTarget()
      Get the target that was executing within the .specification file (e.g., x86, x64).
      java.lang.String toString()
      Generate a sane string representation of this error and the context where it occurred.
      • Methods inherited from class java.lang.Throwable

        addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • program

        protected crystalpalace.spec.SpecProgram program
        The program where the error occurred.
      • message

        protected java.lang.String message
        The message associated with the error.
    • Constructor Detail

      • SpecProgramException

        public SpecProgramException​(crystalpalace.spec.SpecProgram program,
                                    java.lang.String message)
        Construct a new program exception.
        Parameters:
        program - The program where the error occurred. We need this to pull state information via these APIs.
        message - A description of what went wrong. These are fairly specific.
    • Method Detail

      • getCommand

        public java.lang.String getCommand()
        Returns the last command that was run or running when this error occured.
        Returns:
        the last command run
      • getArgument

        public crystalpalace.spec.SpecObject getArgument()
        Returns the argument to the was-executing command. This is usually the item that was most recently popped off of the program stack.
        Returns:
        the argument when the last command was run
      • getStack

        public java.util.Stack getStack()
        Get the stack from the .spec file's execution environment. This offers an additional clue about the program state when the error occured.
        Returns:
        the stack from the .spec file's execution environment
      • getMessage

        public java.lang.String getMessage()
        Get the description of the error that generated this exception. These are fairly descriptive and situation specific.
        Overrides:
        getMessage in class java.lang.Throwable
        Returns:
        the error message
      • getTarget

        public java.lang.String getTarget()
        Get the target that was executing within the .specification file (e.g., x86, x64).
        Returns:
        the target when the error occurred.
      • getFile

        public java.lang.String getFile()
        Get the file associated with this program. Note, in the case of the run "file.spec" command--it's possible that this file is not the parent file of the .spec. This will return the file where the error occured, not the top-level .spec file that was run.
        Returns:
        the path to the file where this error occurred.
      • getFileName

        public java.lang.String getFileName()
        Get the shortname of the file where this error occured. In the case of run "file.spec"--the file associated with this error may differ from the top-level .spec file that was run via LinkSpec
        Returns:
        the short file name associated where this error occured.
      • toString

        public java.lang.String toString()
        Generate a sane string representation of this error and the context where it occurred. If I were using this API, I would just call this method and present the results to the end-user. They'll figure out what it means.
        Overrides:
        toString in class java.lang.Throwable
        Returns:
        a string representation of this error