Skip to main content

Errors

InvalidUsageError

Class

InvalidUsageError(message: 'str') -> 'None'

You have violated the slackblocks API or Slack Web API in a way that has been caught by validation checks.

All more-specific validation exceptions raised by slackblocks subclass this exception, so except InvalidUsageError catches every library-raised validation failure.

Arguments

ArgumentTypeDescription
messagestra custom error message providing details of the API
violation.

LengthError

Class

LengthError(message: 'str') -> 'None'

A string or list length is outside the allowed bounds for a field.

Typical sources: a Text body longer than the Slack-enforced limit, an option list with too many entries, an action_id over 255 characters, etc.

MissingRequiredError

Class

MissingRequiredError(message: 'str') -> 'None'

At least one of a set of arguments was required, but none was provided.

Typical sources: ConversationFilter invoked with none of its three filter fields set; SectionBlock invoked with neither text nor fields.

MutualExclusivityError

Class

MutualExclusivityError(message: 'str') -> 'None'

Two arguments that must not both be set were both set.

Typical sources: passing both image_url and slack_file to Image; passing both options and option_groups to a StaticSelectMenu; passing both url and id to SlackFile.

RangeError

Class

RangeError(message: 'str') -> 'None'

A numeric value is outside the allowed bounds for a field.

Typical sources: NumberInput.min_value > max_value, integer arguments outside an enforced min_value / max_value range.

TypeMismatchError

Class

TypeMismatchError(message: 'str') -> 'None'

An argument is of the wrong type or an unexpected discrete value.

Typical sources: passing a non-Option element into a list expected to hold Option instances; supplying a colour string that is neither a hex code nor a Color enum; supplying a string outside an enumerated set (e.g. ColumnSettings.align='banana').