Skip to content

Conformance Examples 0.1.0 — Partials: origin-soft-failures

soft-failure-in-root-has-empty-partial-stack

A soft failure in the root template is stamped with a Root-only stack, so its encoded partialStack is empty. abs on a non-numeric input soft-fails as TypeMismatch and renders 'null'.

Template

{{ x | abs }}

Context

{
    "x": "not-a-number"
}

Output

null

soft-failure-inside-partial-carries-partial-key

A soft failure raised while rendering a partial is stamped with that partial's key, so its partialStack is ['mathPartial'].

Template

{{> mathPartial }}

Context

{
    "x": "not-a-number"
}

Partials

mathPartial:

{{ x | abs }}

Output

null

soft-failure-in-partial-reports-partial-own-location

A soft failure on the second line of a partial's body reports that partial's own line/column, not the caller's — the failing expression is line 2 of 'inner', not line 1 of the root template that invokes it.

Template

{{> inner }}

Context

{
    "x": "not-a-number"
}

Partials

inner:

ok
{{ x | abs }}

Output

ok
null

soft-failure-in-doubly-nested-partial-carries-full-stack

A soft failure in a partial reached through another partial carries the full chain of partial keys, outermost-first.

Template

{{> outer }}

Context

{
    "x": "not-a-number"
}

Partials

outer:

{{> inner }}

inner:

{{ x | abs }}

Output

null

Source fixture: partials/origin-soft-failures.json