Consider the following example program:
:- use_module(library(http/http_server)).
run :- http_listen(7890, [
get(works, works),
get(halt, halt_error),
get(throw, throw_error),
get(false, false_error)
]), halt.
works(_, Response) :- http_body(Response, text("ok!")).
halt_error(_, _) :- halt.
throw_error(_, _) :- throw(error).
false_error(_, _) :- false.
- Opening
/halt does not terminate the program as expected, instead it hangs up
- Opening
/throw does throw an error and it seems to make http_listen exit, but halt after it still doesn't exit the program. Toplevel can be interacted with, but calling halt doesn't terminate toplevel after that.
- Opening
/false returns Internal Server Error. The message could be more descriptive! This doesn't seem to hang up though. More importantly, there doesn't seem to be a way to detect this error happening server side. I'd expect this to at least throw an exception?
Consider the following example program:
/haltdoes not terminate the program as expected, instead it hangs up/throwdoes throw an error and it seems to make http_listen exit, but halt after it still doesn't exit the program. Toplevel can be interacted with, but callinghaltdoesn't terminate toplevel after that./falsereturns Internal Server Error. The message could be more descriptive! This doesn't seem to hang up though. More importantly, there doesn't seem to be a way to detect this error happening server side. I'd expect this to at least throw an exception?