From 0cd93185d6dd84d2f0e65e9534d68c51531869f7 Mon Sep 17 00:00:00 2001 From: swyx Date: Tue, 17 Nov 2020 17:07:10 +0800 Subject: [PATCH] document await...catch shorthand --- site/content/docs/02-template-syntax.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/site/content/docs/02-template-syntax.md b/site/content/docs/02-template-syntax.md index 119488aacc..ac7ca7abf3 100644 --- a/site/content/docs/02-template-syntax.md +++ b/site/content/docs/02-template-syntax.md @@ -300,6 +300,9 @@ An each block can also have an `{:else}` clause, which is rendered if the list i ```sv {#await expression then name}...{/await} ``` +```sv +{#await expression catch name}...{/await} +``` --- @@ -342,6 +345,16 @@ If you don't care about the pending state, you can also omit the initial block. {/await} ``` +--- + +If conversely you only want to show the error state, you can omit the `then` block. + +```sv +{#await promise catch error} +

The error is {error}

+{/await} +``` + ### {#key ...} ```sv