Errors and exit codes
There are no custom error classes in Fairyfly. You get QuickJS's built-ins
— Error, TypeError, SyntaxError, RangeError — plus a handful of
APIs that reject with plain strings.
Uncaught errors
An exception that escapes your script prints the message and stack to stderr, then the process exits 1:
Note the doubled Error: Error: prefix, the at <eval> frame carrying
file:line:column, and the blank line before the shell prompt.
try / catch works as usual — for the APIs listed below.
What throws (and what doesn't)
Sync
fsswallows errors today. A missing file, a bad directory, an unreadable path — all returnundefinedwith no exception. Always checkfs.exists()first, or use the Promise variants, which report the real error:
Unhandled promise rejections are silent
In script context a rejected Promise with no handler prints nothing and the process exits 0:
Always attach a .catch, or await inside a try. In an HTTP handler the
runtime does catch it — a rejected handler Promise becomes a 500
response.
fetch rejects with strings
Failed fetches reject with a string, not an Error, so e.message is
undefined:
A diagnostic line also goes to stderr:
Server-side failures
Exit codes
Message catalogue
Strings you'll see in practice — useful for assertions in tests:
Gotchas
e.messageisundefinedforfetchrejections — checktypeof e.- A successful
fs.*Asynccall hangs the process afterwards (it prints, then never exits) — Known issue, see fs. - Sync
fsfailures are silent; don't writetry/catcharound them expecting an exception. - There is no
process.on("uncaughtException")and nounhandledRejectionhook — there's nothing to subscribe to. - Errors thrown inside a
Workersurface on the parent viaonerror.
