mirror of https://github.com/sveltejs/svelte
Merge branch 'tanhauhau/await-then-catch-block' of https://github.com/tanhauhau/svelte into tanhauhau-tanhauhau/await-then-catch-block
commit
1bb5d8646e
@ -0,0 +1,5 @@
|
|||||||
|
{#await thePromise}
|
||||||
|
<p>loading...</p>
|
||||||
|
{:catch theError}
|
||||||
|
<p>oh no! {theError.message}</p>
|
||||||
|
{/await}
|
@ -0,0 +1,168 @@
|
|||||||
|
{
|
||||||
|
"html": {
|
||||||
|
"start": 0,
|
||||||
|
"end": 99,
|
||||||
|
"type": "Fragment",
|
||||||
|
"children": [
|
||||||
|
{
|
||||||
|
"start": 0,
|
||||||
|
"end": 99,
|
||||||
|
"type": "AwaitBlock",
|
||||||
|
"expression": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"start": 8,
|
||||||
|
"end": 18,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 8
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 18
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"name": "thePromise"
|
||||||
|
},
|
||||||
|
"value": null,
|
||||||
|
"error": "theError",
|
||||||
|
"pending": {
|
||||||
|
"start": 19,
|
||||||
|
"end": 39,
|
||||||
|
"type": "PendingBlock",
|
||||||
|
"children": [
|
||||||
|
{
|
||||||
|
"start": 19,
|
||||||
|
"end": 21,
|
||||||
|
"type": "Text",
|
||||||
|
"raw": "\n\t",
|
||||||
|
"data": "\n\t"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"start": 21,
|
||||||
|
"end": 38,
|
||||||
|
"type": "Element",
|
||||||
|
"name": "p",
|
||||||
|
"attributes": [],
|
||||||
|
"children": [
|
||||||
|
{
|
||||||
|
"start": 24,
|
||||||
|
"end": 34,
|
||||||
|
"type": "Text",
|
||||||
|
"raw": "loading...",
|
||||||
|
"data": "loading..."
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"start": 38,
|
||||||
|
"end": 39,
|
||||||
|
"type": "Text",
|
||||||
|
"raw": "\n",
|
||||||
|
"data": "\n"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"skip": false
|
||||||
|
},
|
||||||
|
"then": {
|
||||||
|
"start": null,
|
||||||
|
"end": null,
|
||||||
|
"type": "ThenBlock",
|
||||||
|
"children": [],
|
||||||
|
"skip": true
|
||||||
|
},
|
||||||
|
"catch": {
|
||||||
|
"start": 39,
|
||||||
|
"end": 91,
|
||||||
|
"type": "CatchBlock",
|
||||||
|
"children": [
|
||||||
|
{
|
||||||
|
"start": 56,
|
||||||
|
"end": 58,
|
||||||
|
"type": "Text",
|
||||||
|
"raw": "\n\t",
|
||||||
|
"data": "\n\t"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"start": 58,
|
||||||
|
"end": 90,
|
||||||
|
"type": "Element",
|
||||||
|
"name": "p",
|
||||||
|
"attributes": [],
|
||||||
|
"children": [
|
||||||
|
{
|
||||||
|
"start": 61,
|
||||||
|
"end": 68,
|
||||||
|
"type": "Text",
|
||||||
|
"raw": "oh no! ",
|
||||||
|
"data": "oh no! "
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"start": 68,
|
||||||
|
"end": 86,
|
||||||
|
"type": "MustacheTag",
|
||||||
|
"expression": {
|
||||||
|
"type": "MemberExpression",
|
||||||
|
"start": 69,
|
||||||
|
"end": 85,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 4,
|
||||||
|
"column": 12
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 4,
|
||||||
|
"column": 28
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"object": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"start": 69,
|
||||||
|
"end": 77,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 4,
|
||||||
|
"column": 12
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 4,
|
||||||
|
"column": 20
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"name": "theError"
|
||||||
|
},
|
||||||
|
"property": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"start": 78,
|
||||||
|
"end": 85,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 4,
|
||||||
|
"column": 21
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 4,
|
||||||
|
"column": 28
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"name": "message"
|
||||||
|
},
|
||||||
|
"computed": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"start": 90,
|
||||||
|
"end": 91,
|
||||||
|
"type": "Text",
|
||||||
|
"raw": "\n",
|
||||||
|
"data": "\n"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"skip": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"code": "invalid-catch-placement",
|
||||||
|
"message": "Cannot have an {:catch} block outside an {#await ...} block",
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 7,
|
||||||
|
"character": 7
|
||||||
|
},
|
||||||
|
"pos": 7
|
||||||
|
}
|
@ -0,0 +1 @@
|
|||||||
|
{:catch theValue}
|
@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"code": "invalid-then-placement",
|
||||||
|
"message": "Cannot have an {:then} block outside an {#await ...} block",
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 6,
|
||||||
|
"character": 6
|
||||||
|
},
|
||||||
|
"pos": 6
|
||||||
|
}
|
@ -0,0 +1 @@
|
|||||||
|
{:then theValue}
|
Loading…
Reference in new issue