error
The error tag generates an error object.

Syntax

This tag has several usage styles, each style resulting in a valid action object.

Block syntax

Liquid
JSON
{% error %}
{
"foo": "bar"
}
{% enderror %}
{
"error": {
"foo": "bar"
}
}

Tag syntax, single argument

Liquid
JSON
{% error "foobar" %}
{
"error": "foobar"
}

Tag syntax, mapped arguments

Liquid
JSON
{% assign details = hash %}
{% assign details["foo"] = "bar" %}
​
{% error message: "Something went wrong!", details: details %}
{
"error": {
"message": "Something went wrong!",
"details": {
"foo": "bar"
}
}
}
Last modified 1yr ago
Copy link
Edit on GitHub
On this page
Syntax
Block syntax
Tag syntax, single argument
Tag syntax, mapped arguments