jukebox
All repositories: gitoria
1.2 KB
// #285: a fault abandons this request handler; Error supplies its answer.import { NativeHttpServer, Response } from 'hl:http1'import { env } from 'hl:proc'port = toNumber(env('HL_TEST_PORT'))s = new NativeHttpServer(port = port)on s.request(Hybrid req) {if (req.path == '/health') { return new Response('healthy') }hlOnFault((String located) => { echo('hook') })if (req.path == '/sent') { req.respond.call('send', 202, 'sent') }hlError('route:' + req.path)echo('UNREACHABLE')}on Error(Hybrid e) {if (e.phase != 'event' || e.request != true) { hlError('wrong request context') }echo('handled')if (e.message.includes('/fatal')) { hlError('error-handler-fault') }if (e.message.includes('/text')) { return 'fallback' }if (e.message.includes('/json')) { return { ok = true items = [1, 2] } }if (e.message.includes('/status')) {return new Response('unavailable', { status = 503 headers = { 'X-Fallback' = 'yes' } })}if (e.message.includes('/bytes')) { return new Response(toBytes('raw')) }if (e.message.includes('/empty')) { return '' }if (e.message.includes('/false')) { return false }if (e.message.includes('/zero')) { return 0 }if (e.message.includes('/sent')) { return 'second' }if (e.message.includes('/null')) { return null }}
Branches
Latest commits
- c1b153c4Merge branch 'records-1124c' into mainJukebox
- d7b5e780|||PR Records 2026-11-24 (2): live day72, PR #19 merge, #10 newsmre
- 43b564dbMerge branch 'records-1124b' into mainJukebox
- fa86b08c|||PR Records 2026-11-24: LOG, STATUS, missions 020-023mre
- 0a2ae3daMerge remote-tracking branch 'origin/records-1123' into records-1124mre
- 9a48cfcaMerge branch 'vendor-theme' into mainJukebox
- 170d3735Merge branch 'code-order-2' into mainJukebox
- 3f1918a7|||PR Re-sync layouts theme 4099e64 with Segoe UI firstmre
- 2e7f6a43Vendor virtual-list 489afcf from components.hybrielmre
- 0ba85799Merge branch 'reset-classes' into mainJukebox
- 502eeed5jukebox#20: vendor virtual-list initial resetKey baseline fixmre
- 6d5ce287|||PR jukebox#9 Centralize songs table reads and writes in db.hlmre
- dcca21abjukebox#8 Move copies and queue logic into their topicsmre
- 3b76651cjukebox#20: update virtual-list README pin and resetKey optionsmre
- bc09e1e8|||PR jukebox#20: reset virtual lists through resetKey (partial validation)mre
- a3796dc5Records: live step waits for idlemre
- 3b158e16Records: merges of #9 and #11mre
- 27204167Merge main into records-1123mre
- 10f8a8c8Merge branch 'code-order' into mainJukebox
- 204fc828Merge branch 'day72' into mainJukebox