Record Class LastCrash

java.lang.Object
java.lang.Record
com.botwithus.bot.api.runtime.LastCrash

public record LastCrash(Phase phase, long iteration, Instant when, Throwable cause) extends Record
Immutable record describing a single script failure: the lifecycle phase in which the throwable surfaced, the loop iteration index at the time, the wall-clock Instant the runner observed it, and the throwable itself.

The iteration field is the loop counter at crash time. For crashes outside Phase.ON_LOOP the value is the most recent loop count observed by the profiler — useful for ordering but not load-bearing.

  • Constructor Summary

    Constructors
    Constructor
    Description
    LastCrash(Phase phase, long iteration, Instant when, Throwable cause)
    Creates an instance of a LastCrash record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the value of the cause record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    long
    Returns the value of the iteration record component.
    Returns the value of the phase record component.
    Renders the throwable as the conventional multi-line stack trace string.
    final String
    Returns a string representation of this record class.
    Returns the value of the when record component.

    Methods inherited from class Object

    getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • LastCrash

      public LastCrash(Phase phase, long iteration, Instant when, Throwable cause)
      Creates an instance of a LastCrash record class.
      Parameters:
      phase - the value for the phase record component
      iteration - the value for the iteration record component
      when - the value for the when record component
      cause - the value for the cause record component
  • Method Details

    • stackTrace

      public String stackTrace()
      Renders the throwable as the conventional multi-line stack trace string. Suitable for direct display in GUI surfaces (collapsing-header bodies, log lines, notification tooltips).
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • phase

      public Phase phase()
      Returns the value of the phase record component.
      Returns:
      the value of the phase record component
    • iteration

      public long iteration()
      Returns the value of the iteration record component.
      Returns:
      the value of the iteration record component
    • when

      public Instant when()
      Returns the value of the when record component.
      Returns:
      the value of the when record component
    • cause

      public Throwable cause()
      Returns the value of the cause record component.
      Returns:
      the value of the cause record component