| @@ -1,4 +1,4 @@ |
| 1 |
|
-import {getById, h, span, addClass, div} from '/common.module.js' |
|
1 |
+import {getById, writeError, h, span, addClass, div} from '/common.module.js' |
| 2 |
2 |
import {DACTAL} from "/dactal.js" |
| 3 |
3 |
|
| 4 |
4 |
const enterEvent = new KeyboardEvent('keydown', { |
| @@ -26,13 +26,18 @@ export async function onLoad() { |
| 26 |
26 |
input.onkeydown = async (e) => { |
| 27 |
27 |
if (e.key === "Enter" && !e.shiftKey) { |
| 28 |
28 |
e.preventDefault() |
| 29 |
|
- let result = await dactal.query(input.value) |
| 30 |
|
- |
| 31 |
|
- const results = getById("results") |
| 32 |
|
- results.replaceChildren(renderValue(result.slice(0, 100))) |
| 33 |
|
- |
| 34 |
|
- if (result.length > 100) { |
| 35 |
|
- results.appendChild(div(span(`Not showing ${result.length - 100} more results.`))) |
|
29 |
+ |
|
30 |
+ try { |
|
31 |
+ let result = await dactal.query(input.value) |
|
32 |
+ |
|
33 |
+ const results = getById("results") |
|
34 |
+ results.replaceChildren(renderValue(result.slice(0, 100))) |
|
35 |
+ |
|
36 |
+ if (result.length > 100) { |
|
37 |
+ results.appendChild(div(span(`Not showing ${result.length - 100} more results.`))) |
|
38 |
+ } |
|
39 |
+ } catch (e) { |
|
40 |
+ writeError(e.message) |
| 36 |
41 |
} |
| 37 |
42 |
} |
| 38 |
43 |
} |