Check syntax

This guide shows you how to check a site for syntax errors, make your own error page, and find error details.
Terminal
cow check site
cow check site --json
cow check checks pages and helpers without starting a server or executing application code. For each syntax error, it prints the file path, line, column, message, and the code COW_SYNTAX, and it exits with status 1.
A successful check does not guarantee that imports resolve or that values are valid at runtime.

Make an error page

Put _error.cow in your site root. It receives details through locals.error.
_error.cow
<?js res.type('html') ?>
<h1><?= locals.error.status === 404 ? 'Lost in the pasture?' : 'Something went wrong.' ?></h1>
<p><a href="/">Let’s head home.</a></p>
Output — a URL with no page, status 404
<h1>Lost in the pasture?</h1>
<p><a href="/">Let’s head home.</a></p>
Cow keeps the original HTTP status.
Warning: Do not display private error messages, causes, or stacks to visitors. Custom error pages receive diagnostics even in production.

Find error details

Development errors map back to original Cow and imported TypeScript locations. Production fallback pages hide the details. Infrastructure failures use the server fallback. Once streaming starts, errors cannot replace the response.

See what Cow is running

cow.info() provides HTML or JSON diagnostics for versions, settings, and capabilities.
Warning: Put diagnostic pages behind your own access control rather than exposing operations information unnecessarily.