Back end
Rules & failures
Accent
Scheme
Backdrop motion
Back end

Rules & failures

Every server fn says who may call it: requires anyone, signedIn, or a rule. A rule is a named test in the language of a model's rules; a limit caps how often. When a call fails, the page is told words for a person and a kind for the program.
Who is askingThe cards below answer differently signed in and signed out. Make a throwaway account here (an address under playground.test), or sign in on the Back end page.
Nobody is signed in.
rule, and requiresA rule is asked after the arguments are checked and before the body runs. Nobody signed in: 401, kind signin (the rule reads me). Signed in but the rule says no: 403, kind refused. Join the club, and the same call answers.
not a member
word() said
Press word() signed out, signed in, and in the club.
A rule that reads a settingA rule may read the signed-in address (me.email, in lower case) and a setting of the back end's, read once as it starts. The admins here are PLAYGROUND_ADMINS: unset, nobody is one. Set it to your address and restart the back end to open the admin panel (Extensions page).
adminWord() said
Press it.
limitThree calls at once, then one every twenty seconds, for each caller (who is signed in, else the address). Over it: 429, kind limited, and err.data.retryAfter. A call the rule refused is not counted.
the four answers
Press it.
The words of each kindThe kind is what a program tells failures apart by; the words are for a person, and are never the kind's name. Each Try asks this back end for that failure; what it said is beside the words the docs give. Some cannot be made here without harm (no line, a call too long, 16 MB): their words are as the docs say.
offline
could not reach the servernothing answered, after the call was tried again (0.3 s, 1.2 s); a write kept while the line was down and given up on adds: it was not sent
timeout
save took too longonly where the program says app … timeout=; a call to another back end that gave up
signin
sign in first401: requires signedIn (or a rule that reads me), and nobody is. Try it signed out.
refused
you may not do that403: a rule said no. Try it signed in (and not an admin).
invalid
pgTyped: n is to be a number400: an argument of the wrong type; no such call is 404, no such call
toobig
save: what was sent is more than 16777216 bytes413: a call is 16 MB at most (MOTE_MAX_BODY)
limited
too many tries: wait 20 seconds and try again429: a limit; err.data.retryAfter in seconds. Try makes four calls.
fault
pgBreaks could not be done (id …)500: the back end broke. The page is told only the id; the log has the rest under it.
said
what fail was given422: fail("…")?, or a model's rule or check
stock
out of stockthe program's own kind: fail("out of stock", {kind: "stock", data: {left: 0}})?
secret("KEY")A setting the back end does not start without, which its log never shows. This playground declares none (it has to start anywhere), so this is the code and what happens.
started with PAY_KEY unset, it says, and exits
mote: this back end does not start without its secrets, and one is not set: PAY_KEY. Set it where the back end runs (an environment variable; `.env.example` beside the build lists them). A setting that may be left unset is read with `env`, not `secret`.
a log line that would hold it
{"time":"…","level":"info","msg":"paying","key":"[secret]","call":"charge","id":"…"}
mote build lists every secret() and env() the program reads in dist/.env.example, and dist/server/api.json names the secrets (never their values).
esc
Pages
StartStart
Buttons & badgesComponents
Cards & disclosureComponents
Dialogs & drawersComponents
Menus & commandsComponents
Dates & tablesComponents
ChartsComponents
Chart galleryComponents
FieldsComponents
ChoicesComponents
DisplayComponents
NavigationComponents
Popovers & sheetsComponents
MessagesChat & AI
Prompt inputChat & AI
Reasoning & toolsChat & AI
Developer partsChat & AI
ConversationChat & AI
Code artifactsChat & AI
VoiceChat & AI
Code blocksChat & AI
MarkdownChat & AI
EditorElements
TerminalElements
FlowElements
3D boxesElements
PaintElements
SurfaceElements
MediaElements
IconsElements
PrimitivesElements
SQLBatteries
StorageBatteries
Net & resourcesBatteries
Crypto & bytesBatteries
ZipBatteries
TablesBatteries
PDFBatteries
TimeBatteries
ImagesBatteries
ScanBatteries
Video & audioBatteries
SearchBatteries
SyntaxBatteries
PatternsBatteries
NotifyBatteries
ShareBatteries
State & logicLanguage
WorkersLanguage
Events & elementsLanguage
StylingLanguage
RoutesLanguage
ShortcutsLanguage
Long listsLanguage
Failures & tryLanguage
Back endBack end
Models & writesBack end
Rules & failuresBack end
Jobs & schedulesBack end
Running itBack end
ExtensionsBack end
AIBack end
AnalyticsBack end
AboutAbout
↑↓move
↵open
676 places · ranked by BM25