Error Codes
Template errors
wisp build, wisp dev and wisp check show a template error with its file, line and column, then its code. The line of the template follows, with a caret under the column, then one help: line:
src/routes/+page.wisp:2:4: unclosed ${ (W0101)
|
2 | <p>${data.count</p>
| ^
= help: Close it. The caret shows where it starts.
The wisp_check tool of wisp mcp returns the code in the code field of each error.
Each place in the build that finds a template error gives its code. So a code names a group of errors, and it stays the same when the text of a message changes.
| Code | Error | Help |
|---|---|---|
W0101 | A tag, block, quote or expression has no end. | Close it. The caret shows where it starts. |
W0102 | A close does not match the open tag or block. | Make each close match the last tag or block that is open. |
W0103 | A block has no expression, or a wrong form. | Write the block in the form that the message shows. |
W0104 | A block, value or directive is in a place where it is not allowed. | Move it to a place that the message names. |
W0105 | A component or its props are wrong. | Give each prop once, as name=${expr} or name="text". |
W0106 | An attribute or a directive on a tag is wrong. | Write the attribute in the form that the message shows. |
W0107 | A <wisp:…> element is wrong or unknown. | Use a Wisp element that exists, in the form that the message shows. |
W0108 | An expression or comment is in a place that cannot hold one. | Move the expression out, or write the text without it. |
W0109 | A {@…} directive is wrong or unknown. | Write the directive as the message shows. See /docs/syntax. |
W0110 | A block name is unknown. | Use a block that exists. The message lists them. |
W0111 | A ${…} or {:…} is empty or has a wrong form. | Write one expression in it, as the message shows. |
W0112 | A snippet is wrong. | Give each snippet one name and the arguments it takes. |
W0113 | A name in a block is wrong, or Wisp keeps it for itself. | Use a plain name that is not cx. |
W0114 | A <script> or <style> is wrong or in a wrong place. | Put the client script and the scoped style at the top level. |
W0115 | A block starts and ends in different places. | Start and end each block in the same element, or in the same tag. |
W0116 | A filter is wrong or unknown. | Use a filter that exists. See /docs/syntax. |
W0117 | Syntax of another framework. | Write the Wisp syntax that the message shows. |
W0118 | A form with fields or guard, or a link with active, is wrong. | Give the form a named action, or the link an href, as the message shows. |
W0119 | A page that the browser draws has server markup. | Write the browser forms {:…}, {:#if} and {:#each}. |
W0120 | A {:await} of a {:#try} is in the wrong place. | Write one {:await} in a {:#try}, after its body and before its {:catch}. |
Rust errors in templates
The build compiles each template to Rust in wisp.rs, in the build's output folder. A line of that file that came from a template or an app file ends with its origin, such as // src/routes/+page.wisp:2. When rustc finds an error on such a line, wisp build, wisp dev and wisp check show it against the .wisp file and line. A line with no origin of its own takes the origin of the nearest line above it in its function. A note keeps the place in wisp.rs:
error[E0609]: no field `count` on type `&Data`
--> src/routes/+page.wisp:2:11
|
2 | <p>${data.count}</p>
| ^^^^^ unknown field
|
= note: available field is: `n`
= note: generated code at target/debug/build/app-1/out/wisp.rs:55:35
Panics in dev
Under wisp dev, a handler panic in generated code names the .wisp file and line in the 500 page and in the dev overlay, with the same origin. The page also shows a code frame of that line, with two lines above and below it and a caret. Release builds do not read wisp.rs or any source. This costs nothing in release. See Debugging Rust handlers.
Is This Page Useful?