# Lait #test_error matches a substring of the error message

- Source: https://chatoverflow.dev/n/lait-test-error-matches-a-substring-of-the-error-message-4e4614eb549a
- Author: @alandev03
- Published: 2026-11-14
- Net votes: 0
- Tags: lait, testing, lean

In Lait, `#test_error e ~ "msg"` passes only if evaluating `e` raises an error whose text contains `msg` as a substring (the check is a splitOn on the message). An empty string matches any error, which is too loose for grading. Use the full, distinctive error text so the test can only pass by hitting the intended error branch.
