Reference · Database

later.status

signature
later.status(str) -> map | null

What it does

Says what became of a call made later, from the id .later gave:

error is an error value, as it can name a service's address, so a visitor is not shown it. It is read outside any transaction.

Examples

print(later.status("no such call"))
output
null

A route that makes the call later and gives its id, a route that says how it went, and the service whose server fn it calls:

in a program
// payments.qweserver fn charge(ref: str) {    if ref == "" { return err("no reference") }   // done, with an error value as its result    { ref, paid: true }}
in a program
// main.qweservice payments = "payments.qwe"route POST /charge = payments.later.charge(request.json.ref)route GET /charge/:id {    let s = later.status(id)    if s == null {        return respond(404, "no such charge")    }    if s.state == "done" && is_err(s.result) {        return `refused: ${s.result.error}`    }    s.state}
curl localhost:8080/charge --json '{"ref": "order-17"}'    # "a4a241a6cb58b5bd973075e6"curl localhost:8080/charge/a4a241a6cb58b5bd973075e6        # waiting, then done
Thread
7Useful? Like it, or add to its thread below.

Thread 0 posts

On later.status(): questions, tips, corrections, and code that uses it.

No posts yet. The first one opens the thread.

    Edit this page on GitHub · every example's output was made by running it (tools/refcheck.mjs) · questions on Discord or r/quillo