Errors and limits
Error kinds
Section titled “Error kinds”| Kind | Cause |
|---|---|
load |
Syntax error, a throw at the top level, a missing method, invalid meta |
inputs |
A required input is missing, or a value has the wrong type or is out of range |
script |
A phase threw, or its promise rejected. The message and line number are shown to the user. |
timeout |
A phase took too long while waiting, usually on the network |
runaway |
A phase took too long while executing script code, meaning an endless loop. The host abandons the context, and after 4 runaways it stops running scripts until the app restarts. |
limit |
The state is over 64 KB or the store is over 256 KB (or, on the server, the run used more than 128 MB of memory) |
invalidOutput |
summary() returned something that is not an object |
cancelled |
The run was cancelled, for example because background time ran out |
Whatever the kind, a failed run commits nothing: the item keeps its previous state, store and card, and shows the error.
The message of an error your script throws is shown to the user as is, so make it useful: say what went wrong and what to do about it.
Limits
Section titled “Limits”| Limit | Value |
|---|---|
| Script size | 1 MB |
| Top-level code | 5 s |
run timeout |
meta.timeout: 20 s by default, 1–60 s |
onNotify, summary |
2 s each |
validate |
20 s |
| State | 64 KB serialized |
| Store | 256 KB in total |
| HTTP | 100 requests per run, 5 MB per response, 30 s per request by default |
| Sockets | 4 connections per run, 5 MB received per run, 1 MB per line or delimited read |
ctx.sleep |
60 s |
crypto.randomBytes |
65,536 bytes |
| Log | 500 entries of 2,000 characters |
| Summary | 8 blocks; title 80, subtitle 120 characters; see blocks |
| Notifications | 20 per run; title and subtitle 120, body 1,000 characters |
| Delivery | 10 per item per rolling hour, then one “+N more” |
| Cooldown | 6 h by default, per (item, type, key) |
| Run history | The last 50 runs per item |
| Notification history | The newest 200 per item |
| Server memory | 128 MB per run |