Exceptions

class arcade.exceptions.OutsideRangeError(var_name: str, value: _CT, lower: _CT, upper: _CT)[source]

Bases: ValueError

Raised when a value is outside and expected range

This class and its subclasses are intended to be Arcade-internal helpers to clearly signal exactly what went wrong. Each helps type annotate and template a string describing exactly what went wrong.

Parameters:
  • var_name – The name of the variable or argument

  • value – The value that fell outside the expected range

  • lower – The lower bound, inclusive, of the range

  • upper – The upper bound, inclusive, of the range

class arcade.exceptions.IntOutsideRangeError(var_name: str, value: int, lower: int, upper: int)[source]

Bases: OutsideRangeError

An integer was outside an expected range

This class was originally intended to assist deserialization from data packed into ints, such as Color.

Parameters:
  • var_name – The name of the variable or argument

  • value – The value that fell outside the expected range

  • lower – The lower bound, inclusive, of the range

  • upper – The upper bound, inclusive, of the range

class arcade.exceptions.FloatOutsideRangeError(var_name: str, value: float, lower: float, upper: float)[source]

Bases: OutsideRangeError

A float value was outside an expected range

Parameters:
  • var_name – The name of the variable or argument

  • value – The value that fell outside the expected range

  • lower – The lower bound, inclusive, of the range

  • upper – The upper bound, inclusive, of the range

class arcade.exceptions.ByteRangeError(var_name: str, value: int)[source]

Bases: IntOutsideRangeError

An int was outside the range of 0 to 255 inclusive

Parameters:
  • var_name – the name of the variable or argument

  • value – the value to fall outside the expected range

class arcade.exceptions.NormalizedRangeError(var_name: str, value: float)[source]

Bases: FloatOutsideRangeError

A float was not between 0.0 and 1.0, inclusive

Note that normalized floats should not normally be bound-checked as before drawing as this is taken care of on the GPU side.

The exceptions to this are when processing data on the Python side, especially when it is cheaper to bound check two floats than call clamping functions.

Parameters:
  • var_name – the name of the variable or argument

  • value – the value to fall outside the expected range

class arcade.exceptions.PerformanceWarning[source]

Bases: Warning

Issuing performance warnings on slow paths.

class arcade.exceptions.ReplacementWarning[source]

Bases: Warning

Issuing warnings about naming and functionality changes.

arcade.exceptions.warning(warning_type: type[Warning], message: str = '', **kwargs)[source]

Warning decorator