Skip to content

Make system more resiliant to missing data from queries? #201

Open
@jmbrunskill

Description

@jmbrunskill

Describe the bug

[2023-10-13T04:48:02Z ERROR service::notification::enqueue] Failed to render notification body template: Error { kind: Msg("Failed to render 'body_template'"), source: Some(Error { kind: Msg("Variable `num_of_stores_created_stock_take_within60days.0.num_of_stores_created_stock_take_within60days` not found in context while rendering 'body_template'"), source: None }) }

To Reproduce

Create a query that returns no rows.

Try to use that query result in your template

Expected behaviour

Not sure! Maybe should fail, but also might fail unexpectedly at a time when you expect it wouldn't.
Make should still render what it can??

Looks like we could use tera defaults (if we know what we're doing in a template)

https://keats.github.io/tera/docs/#default
{{ value | default(value=1) }}

Additional context

Maybe the best idea to allow optional default values in the template params?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions