Skip to main content

Validation And Errors

This page documents the public Java API for validation and errors, generated from the Javadoc by the javadoc tool. Values are immutable, builders are concrete and fluent, validation runs when you call .build(), and typed getters read built values back.

ErrorCategory

Stable validation categories shared by every slackblocks implementation.

ConstantSlack valueMeaning
LENGTH_EXCEEDEDlength-exceededA string or collection falls outside Slack's documented length limits.
OUT_OF_RANGEout-of-rangeA numeric value falls outside Slack's documented range.
MUTUALLY_EXCLUSIVEmutually-exclusiveTwo fields that cannot coexist were supplied together.
TYPE_MISMATCHtype-mismatchA value is not an accepted Slack object or scalar type.
MISSING_REQUIREDmissing-requiredA required field or collection is absent.
INVALID_USAGEinvalid-usageA combination of otherwise valid values cannot be used together.

WireValue

Returns the language-neutral category used by the conformance manifest.

public String wireValue()

Returns: the kebab-case category value

ValidationException

Thrown when a builder cannot produce a valid Slack Block Kit value.

This is an IllegalArgumentException, so code that already treats invalid arguments uniformly continues to work. Catch ValidationException when you need the stable category or the path of the invalid field. Paths start with the public Java type being built, for example SectionBlock.fields[2].text.

GetCategory

Returns the stable cross-language error category.

public ErrorCategory getCategory()

Returns: the error category

Related types: ErrorCategory

GetPath

Returns the dotted path of the invalid field, starting with the Java type being built.

public String getPath()

Returns: the field path