Class Exception

All Implemented Interfaces:
Proxy

@Generated("org.javagi.JavaGI") public final class Exception extends GObject
JSCException represents a JavaScript exception.
  • Constructor Details

    • Exception

      public Exception(MemorySegment address)
      Create a Exception instance for the provided memory address.
      Parameters:
      address - the memory address of the native object
    • Exception

      public Exception(Context context, String message)
      Create a new JSCException in context with message.
      Parameters:
      context - a JSCContext
      message - the error message
    • Exception

      public Exception()
      Create a new Exception.
  • Method Details

    • getType

      public static @Nullable Type getType()
      Get the GType of the Exception class.
      Returns:
      the GType
    • getMemoryLayout

      public static MemoryLayout getMemoryLayout()
      The memory layout of the native struct.
      Returns:
      the memory layout
    • asParent

      protected Exception asParent()
      Return this instance as if it were its parent type. Comparable to the Java super keyword, but ensures the parent typeclass is also used in native code.
      Overrides:
      asParent in class GObject
      Returns:
      the instance as if it were its parent type
    • printf

      public static Exception printf(Context context, String format, Object... varargs)
      Create a new JSCException in context using a formatted string for the message.
      Parameters:
      context - a JSCContext
      format - the string format
      varargs - the parameters to insert into the format string
      Returns:
      a new JSCException.
    • withName

      public static Exception withName(Context context, String name, String message)
      Create a new JSCException in context with name and message.
      Parameters:
      context - a JSCContext
      name - the error name
      message - the error message
      Returns:
      a new JSCException.
    • withNamePrintf

      public static Exception withNamePrintf(Context context, String name, String format, Object... varargs)
      Create a new JSCException in context with name and using a formatted string for the message.
      Parameters:
      context - a JSCContext
      name - the error name
      format - the string format
      varargs - the parameters to insert into the format string
      Returns:
      a new JSCException.
    • getBacktraceString

      public @Nullable String getBacktraceString()
      Get a string with the exception backtrace.
      Returns:
      the exception backtrace string or null.
    • getColumnNumber

      public int getColumnNumber()
      Get the column number at which this Exception happened.
      Returns:
      the column number of exception.
    • getLineNumber

      public int getLineNumber()
      Get the line number at which this Exception happened.
      Returns:
      the line number of exception.
    • getMessage

      public String getMessage()
      Get the error message of exception.
      Returns:
      the this Exception error message.
    • getName

      public String getName()
      Get the error name of this Exception
      Returns:
      the this Exception error name.
    • getSourceUri

      public @Nullable String getSourceUri()
      Get the source URI of exception.
      Returns:
      the the source URI of exception, or null.
    • report

      public String report()
      Return a report message of exception, containing all the possible details such us source URI, line, column and backtrace, and formatted to be printed.
      Returns:
      a new string with the exception report
    • toString

      public String toString()
      Get the string representation of this Exception error.
      Overrides:
      toString in class Object
      Returns:
      the string representation of exception.
    • builder

      public static Exception.Builder<? extends Exception.Builder> builder()
      A Exception.Builder object constructs a Exception with the specified properties. Use the various set...() methods to set properties, and finish construction with Exception.Builder.build().
      Returns:
      the builder object