Class ScriptRevokedException

java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
com.botwithus.bot.api.runtime.ScriptRevokedException
All Implemented Interfaces:
Serializable

public final class ScriptRevokedException extends RuntimeException
Thrown when a script that was asked to stop — and did not — tries to act on the game.

Java has no way to kill a thread, so a script that refuses to leave onLoop cannot be terminated. What the runtime can do is cut it off: once a runner reaches Liveness.REVOKED, every RPC attempted from its thread (or from a thread it spawned, such as the walk executor) throws this instead of reaching the game. A script that ignored the stop therefore stops having any effect, even though it is still running.

In practice this usually ends the script for real: stuck scripts are typically looping on an API call rather than spinning in pure computation, so the exception unwinds them out of onLoop.

Scripts must not catch this. Swallowing it in a catch (Exception) inside a retry loop turns a recoverable zombie into an abandoned one. If you need cleanup on stop, use onStop, or poll ScriptContext.isStopRequested() and return from onLoop yourself.

See Also:
  • Constructor Details

    • ScriptRevokedException

      public ScriptRevokedException(String scriptName)
  • Method Details

    • scriptName

      public String scriptName()
      The script whose access was withdrawn.