gitoria

jukebox

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Branchmainc1b153c4Merge branch 'records-1124c' into mainJukeboxmain/plugins/http1/tests/on-error-answers.hl

1.2 KB

  1. // #285: a fault abandons this request handler; Error supplies its answer.
  2. import { NativeHttpServer, Response } from 'hl:http1'
  3. import { env } from 'hl:proc'
  4. port = toNumber(env('HL_TEST_PORT'))
  5. s = new NativeHttpServer(port = port)
  6. on s.request(Hybrid req) {
  7. if (req.path == '/health') { return new Response('healthy') }
  8. hlOnFault((String located) => { echo('hook') })
  9. if (req.path == '/sent') { req.respond.call('send', 202, 'sent') }
  10. hlError('route:' + req.path)
  11. echo('UNREACHABLE')
  12. }
  13. on Error(Hybrid e) {
  14. if (e.phase != 'event' || e.request != true) { hlError('wrong request context') }
  15. echo('handled')
  16. if (e.message.includes('/fatal')) { hlError('error-handler-fault') }
  17. if (e.message.includes('/text')) { return 'fallback' }
  18. if (e.message.includes('/json')) { return { ok = true items = [1, 2] } }
  19. if (e.message.includes('/status')) {
  20. return new Response('unavailable', { status = 503 headers = { 'X-Fallback' = 'yes' } })
  21. }
  22. if (e.message.includes('/bytes')) { return new Response(toBytes('raw')) }
  23. if (e.message.includes('/empty')) { return '' }
  24. if (e.message.includes('/false')) { return false }
  25. if (e.message.includes('/zero')) { return 0 }
  26. if (e.message.includes('/sent')) { return 'second' }
  27. if (e.message.includes('/null')) { return null }
  28. }

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