basilisp-nrepl-async.nrepl-server
logger
- The logger for this namespace.ops
- A map of operations supported by the nREPL server (as keywords) to function handlers for those operations.server-start!
- Creates ansocketserver/ThreadingTCPServer
nREPL server with optionalOPTS
.
basilisp-nrepl-async.utils
error->str
- Converts theERROR
list to a human-readable string and returns it.error-add
- Adds additionalDETAILS
to the existingERROR
list and returns it.error-make
- Returns a list from the provided errorDETAILS
to represent an error.with-eprotect
- Creates a try/catch wrapper aroundBODY
that returns any exception as anerror
prefixed with theid
fromID-OR-OPTS
.
The logger for this namespace.
A map of operations supported by the nREPL server (as keywords) to function handlers for those operations.
(server-start!)
(server-start! opts)
Function.
Creates an socketserver/ThreadingTCPServer
nREPL server with
optional OPTS
. By default, it listens on 127.0.0.1
at a random
available port and blocks for serving clients.
It prints out the nrepl-server-signature
message at startup for
IDEs to pickup the host number to connect to.
OPTS
is a map of options with the following optional keys
:async?
If truthy, runs the server non-blocking in a separate
thread where requests are queued instead of executed
immediately. Returns a map with
:error Contains details of any error during server creation.
:host The host interface the server is bound to.
:port The local port the server is listening on.
:shutdown-fn The function to shutdown the server.
:work-fn The function to process any pending client requests.
:host
The host address to bind to, defaults to 127.0.0.1.
:nrepl-port-file
An optional filepath to write the port number
to. Typically set to .nrepl-port (the default) for the editors to
detect.
:port
The port number to listen to, defaults to 0 which means to
pickup a random available port.
:server*
An optional promise delivering a map on server upbringing
with the following keys
:host The host interface the server is bound to.
:port The local port the server is listening on.
:shutdown-fn The function to shutdown the server.
(error->str error)
Macro.
Converts the ERROR
list to a human-readable string and returns
it. Includes stack traces for any embedded exceptions.
(error-add error & details)
Macro.
Adds additional DETAILS
to the existing ERROR
list and returns
it.
(error-make & details)
Macro.
Returns a list from the provided error DETAILS
to represent an
error.
(with-eprotect id-or-opts & body)
Macro.
Creates a try/catch wrapper around BODY
that returns any exception
as an error
prefixed with the id
from ID-OR-OPTS
.
ID-OR-OPTS
is either a printable object used as the id
, or a map
with the following keys
:id
The id
to prefix the error with.
:on-err-str
[opt] A function to call if an exception is caught,
which accepts the formated error message as only argument.