Skip to content

Commit

Permalink
Subscriptions: Document panic in templates
Browse files Browse the repository at this point in the history
  • Loading branch information
gbjk committed Oct 16, 2024
1 parent 35e4524 commit d52c88d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions exchanges/subscription/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,15 @@ Example:

Assets and pairs should be output in the sequence in AssetPairs since text/template range function uses an sorted order for map keys.

Template functions may modify AssetPairs to update the subscription's pairs, e.g. Filtering out margin pairs already in spot subscription
Template functions may modify AssetPairs to update the subscription's pairs, e.g. Filtering out margin pairs already in spot subscription.

We use separators like this because it allows mono-templates to decide at runtime whether to fan out.

See exchanges/subscription/testdata/subscriptions.tmpl for an example mono-template showcasing various features
See exchanges/subscription/testdata/subscriptions.tmpl for an example mono-template showcasing various features.

Templates do not need to worry about joining around separators; Trailing separators will be stripped automatically.

Template functions should panic to handle errors. They are caught by text/template and turned into errors for use in `subscription.expandTemplate`.

## Contribution

Expand Down

0 comments on commit d52c88d

Please sign in to comment.