Skip to content

Exceptions

phil/accessibility-check

Every exception of the library implements Exception\AccessibilityCheckException, which extends Throwable: catch it to catch them all.

ExceptionExtendsThrown when
InvalidPolicyInvalidArgumentExceptiona limit below 1, a default colour that is not an opaque CSS colour, a token colour that cannot be read, two rules of one identifier
LimitExceededRuntimeExceptiona content larger, deeper, or of more elements or blocks than the policy allows
InvalidContentRuntimeExceptionHTML that is not UTF-8

Messages

FactoryMessage
InvalidPolicy::limit($name, $value)The maximum size must be at least 1; got 0.
InvalidPolicy::colour($name, $value)The foreground must be an opaque CSS colour; got "var(--text)".
InvalidPolicy::duplicateRule($id)Two rules have the identifier "image-alt"; an identifier names one rule.
LimitExceeded::size($bytes, $limit)The content holds 6000000 bytes; at most 5242880 are checked.
LimitExceeded::depth($limit)The content nests deeper than 256 levels.
LimitExceeded::count($limit)The content holds more than 100000 elements or blocks.
InvalidContent::notUtf8()The content is not valid UTF-8.

The constraint turns LimitExceeded and InvalidContent into a violation, the publication guard into a blocker, and the command into the exit code 2.