From d52c88def4e32446d9071c38f609ff47c30f789d Mon Sep 17 00:00:00 2001 From: Gareth Kirwan Date: Thu, 10 Oct 2024 10:23:46 +0700 Subject: [PATCH] Subscriptions: Document panic in templates --- exchanges/subscription/README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/exchanges/subscription/README.md b/exchanges/subscription/README.md index bbc9492c41a..e7616b931e9 100644 --- a/exchanges/subscription/README.md +++ b/exchanges/subscription/README.md @@ -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