Table of Contents

Class InvalidAction

Namespace
Gym.Exceptions
Assembly
Gym.dll

An action outside the action space. The envs mostly assert instead (AssertionError), as Gymnasium's do; CarRacing raises this one, as should a custom env refusing an action.

public class InvalidAction : InvalidActionError, ISerializable
Inheritance
InvalidAction
Implements
Inherited Members
Extension Methods

Remarks

Its base is 0.2's obsolete InvalidActionError (itself an Error), kept until 2.0 so 0.2's catch (InvalidActionError) still compiles and catches it (DR-58): one level Gymnasium's hierarchy does not have. Reference: gymnasium/error.py.

Constructors

InvalidAction()

An error without a message; its Message is empty, as Python's str(error) is.

public InvalidAction()

InvalidAction(string)

An error with Gymnasium's message.

public InvalidAction(string message)

Parameters

message string

The message; Gym's own raise sites pass Gymnasium's text verbatim.

InvalidAction(string, Exception)

An error with a message and its cause.

public InvalidAction(string message, Exception innerException)

Parameters

message string

The message.

innerException Exception

The underlying cause.