Class UnknownKeyException

All Implemented Interfaces:
Serializable

public final class UnknownKeyException extends InteropException
An exception thrown if an object does not contain a hash entry with such a key. Interop exceptions are supposed to be caught and converted into a guest language error by the caller.
Since:
21.1.0
See Also:
  • Method Details

    • getMessage

      public String getMessage()
      Overrides:
      getMessage in class Throwable
      Since:
      21.1.0
    • getUnknownKey

      public Object getUnknownKey()
      Returns the hash key that could not be accessed.
      Since:
      21.1.0
    • create

      public static UnknownKeyException create(Object unknownKey)
      Creates an UnknownKeyException to indicate that a key is missing in the hash object.

      This method is designed to be used in compiled code paths.

      Parameters:
      unknownKey - the key that could not be accessed
      Since:
      21.1.0
    • create

      public static UnknownKeyException create(Object unknownKey, Throwable cause)
      Creates an UnknownKeyException to indicate that a key is missing in the hash object.

      In addition a cause may be provided. The cause should only be set if the guest language code caused this problem. An example for this is a language specific proxy mechanism that invokes guest language code to describe an object. If the guest language code fails to execute and this interop exception is a valid interpretation of the error, then the error should be provided as cause. The cause can then be used by the source language as new exception cause if the InteropException is translated to a source language error. If the InteropException is discarded, then the cause will most likely get discarded by the source language as well. Note that the cause must be of type AbstractTruffleException otherwise an IllegalArgumentException is thrown.

      This method is designed to be used in compiled code paths.

      Parameters:
      unknownKey - the key that could not be accessed
      cause - the guest language exception that caused the error
      Since:
      21.1.0