Class InvalidActionError
- Namespace
- Gym.Exceptions
- Assembly
- Gym.dll
0.2's invalid-action error, kept so 0.2 code that catches or throws it still compiles (DR-58). It is
InvalidAction's base class, so catch (InvalidActionError) catches what CarRacing and custom
envs raise for an action outside their space.
[Obsolete("0.2's InvalidActionError: catch Gym.Exceptions.InvalidAction (CarRacing, custom envs) or NumSharp.AssertionError (the envs that assert their action, as Gymnasium's do). Removed in 2.0 with Gym.Legacy.")]
public class InvalidActionError : Error, ISerializable
- Inheritance
-
InvalidActionError
- Implements
- Derived
- Inherited Members
- Extension Methods
Remarks
Obsolete, and removed in 2.0 with Gym.Legacy. The compatibility is partial: the envs that assert their
action, as Gymnasium's do (LunarLander, CartPole, ...), raise AssertionError, which a
catch (InvalidActionError) does not see. It is an Error, so Gymnasium's hierarchy gains this
one level between Error and InvalidAction; messages, and the Python type
InvalidAction stands for, are unchanged.
Constructors
InvalidActionError()
An error with 0.2's own message, Action is outside of the configured action space., for 0.2 code that throws it.
public InvalidActionError()
InvalidActionError(string)
An error with the given message; InvalidAction passes Gymnasium's through it.
public InvalidActionError(string message)
Parameters
messagestringThe message.
InvalidActionError(string, Exception)
An error with a message and its cause.
public InvalidActionError(string message, Exception innerException)