Class OutcomeManager

  • All Implemented Interfaces:
    Serializable

    public class OutcomeManager
    extends Object
    implements Serializable
    Utility class to manage the outcome of a behaviour in a uniform way
    Author:
    Giovanni Caire
    See Also:
    Serialized Form
    • Constructor Detail

      • OutcomeManager

        public OutcomeManager​(Behaviour bh)
    • Method Detail

      • getExitCode

        public int getExitCode()
        Retrieve the exit-code that indicates whether the behaviour holding this OutcomeManager succeeded (OK) or failed (KO)
        Returns:
        The exit-code that indicates whether the behaviour holding this OutcomeManager succeeded (OK) or failed (KO)
      • isSuccessful

        public boolean isSuccessful()
      • getErrorMsg

        public String getErrorMsg()
        Retrieve the error-message providing details about the reason of failure of the behaviour holding this OutcomeManager .
        Returns:
        The error-message providing details about the reason of failure of the behaviour holding this OutcomeManager or null if the behaviour succeeded
      • error

        public void error​(String msg,
                          Exception e)
        Mark the behaviour holding this OutcomeManager as failed and store the error-message that can then be retrieved by means of the getErrorMsg() method
        Parameters:
        msg - The error message.
        e - The Exception, if any, that caused the behaviour to fail
      • propagateError

        public void propagateError​(String msg)
        Used to propagate an already logged error through a hierarchy of behaviours