Errors
Typed validation errors returned by eager construction and explicit validation.
ErrorCategory
ErrorCategory =
"length-exceeded"|"out-of-range"|"mutually-exclusive"|"type-mismatch"|"missing-required"|"invalid-usage"
Stable machine-readable category attached to every validation error.
InvalidUsageError
Base class for invalid Block Kit input.
Catch this class to handle every slackblocks validation failure, or catch a subclass when the reason matters to application behavior.
Extends
Error
Extended by
Constructors
Constructor
new InvalidUsageError(
path,message):InvalidUsageError
Creates a validation error.
Parameters
| Parameter | Type | Description |
|---|---|---|
path | string | Dot-and-index path to the invalid field. |
message | string | Human-readable explanation of the constraint. |
Returns
Overrides
Error.constructor
Properties
| Property | Modifier | Type | Default value | Description |
|---|---|---|---|---|
category | readonly | ErrorCategory | "invalid-usage" | Machine-readable failure category. |
path | readonly | string | undefined | Dot-and-index path to the invalid payload field. |
LengthError
A string, array, or collection exceeded an allowed minimum or maximum length.
Extends
Constructors
Constructor
new LengthError(
path,message):LengthError
Creates a validation error.
Parameters
| Parameter | Type | Description |
|---|---|---|
path | string | Dot-and-index path to the invalid field. |
message | string | Human-readable explanation of the constraint. |
Returns
Inherited from
Properties
| Property | Modifier | Type | Description | Overrides |
|---|---|---|---|---|
category | readonly | "length-exceeded" | Machine-readable failure category. | InvalidUsageError.category |
path | readonly | string | Dot-and-index path to the invalid payload field. | - |
MissingRequiredError
A required field or one-of requirement was not satisfied.
Extends
Constructors
Constructor
new MissingRequiredError(
path,message):MissingRequiredError
Creates a validation error.
Parameters
| Parameter | Type | Description |
|---|---|---|
path | string | Dot-and-index path to the invalid field. |
message | string | Human-readable explanation of the constraint. |
Returns
Inherited from
Properties
| Property | Modifier | Type | Description | Overrides |
|---|---|---|---|---|
category | readonly | "missing-required" | Machine-readable failure category. | InvalidUsageError.category |
path | readonly | string | Dot-and-index path to the invalid payload field. | - |
MutualExclusivityError
Fields that cannot be used together were both supplied.
Extends
Constructors
Constructor
new MutualExclusivityError(
path,message):MutualExclusivityError
Creates a validation error.
Parameters
| Parameter | Type | Description |
|---|---|---|
path | string | Dot-and-index path to the invalid field. |
message | string | Human-readable explanation of the constraint. |
Returns
Inherited from
Properties
| Property | Modifier | Type | Description | Overrides |
|---|---|---|---|---|
category | readonly | "mutually-exclusive" | Machine-readable failure category. | InvalidUsageError.category |
path | readonly | string | Dot-and-index path to the invalid payload field. | - |
OutOfRangeError
A numeric value fell outside its allowed range.
Extends
Constructors
Constructor
new OutOfRangeError(
path,message):OutOfRangeError
Creates a validation error.
Parameters
| Parameter | Type | Description |
|---|---|---|
path | string | Dot-and-index path to the invalid field. |
message | string | Human-readable explanation of the constraint. |
Returns
Inherited from
Properties
| Property | Modifier | Type | Description | Overrides |
|---|---|---|---|---|
category | readonly | "out-of-range" | Machine-readable failure category. | InvalidUsageError.category |
path | readonly | string | Dot-and-index path to the invalid payload field. | - |
TypeMismatchError
A payload field or nested object has the wrong runtime type.
Extends
Constructors
Constructor
new TypeMismatchError(
path,message):TypeMismatchError
Creates a validation error.
Parameters
| Parameter | Type | Description |
|---|---|---|
path | string | Dot-and-index path to the invalid field. |
message | string | Human-readable explanation of the constraint. |
Returns
Inherited from
Properties
| Property | Modifier | Type | Description | Overrides |
|---|---|---|---|---|
category | readonly | "type-mismatch" | Machine-readable failure category. | InvalidUsageError.category |
path | readonly | string | Dot-and-index path to the invalid payload field. | - |