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
1
{% error %}
2
{
3
"foo": "bar"
4
}
5
{% enderror %}
Copied!
1
{
2
"error": {
3
"foo": "bar"
4
}
5
}
Copied!

Tag syntax, single argument

Liquid
JSON
1
{% error "foobar" %}
Copied!
1
{
2
"error": "foobar"
3
}
Copied!

Tag syntax, mapped arguments

Liquid
JSON
1
{% assign details = hash %}
2
{% assign details["foo"] = "bar" %}
3
​
4
{% error message: "Something went wrong!", details: details %}
Copied!
1
{
2
"error": {
3
"message": "Something went wrong!",
4
"details": {
5
"foo": "bar"
6
}
7
}
8
}
Copied!
Last modified 6mo ago