Skip to content

Say what went wrong, in the format asked for - #30

Merged
bbatsov merged 6 commits into
mainfrom
errors-polish
Oct 20, 2026
Merged

bbatsov merged 6 commits into
mainfrom
errors-polish

Conversation

@bbatsov

@bbatsov bbatsov commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

Failures used to come out as the server's raw exception, or as nothing at all on stdout for --format json. Now each says what's wrong: a namespace that isn't there, a regex that doesn't parse, a file that doesn't balance or can't be read, a session the server lost, a timeout stuck behind an evaluation left in the session. doc -> and where -main also work now, because an argument only counts as an option when it looks like one.

Anything starting with a dash was an option, so doc ->, where -main and
complete -ma failed with an unknown option. An argument is now an option
only when it looks like one: --name, a short -x, or a known short option
with more after it, which stays the unknown option it was.
Most failures, like no server to talk to, a usage mistake or the server
failing an op, only warned on stderr, so --format edn and json left stdout
empty for scripts to choke on. They now come out in the format asked for,
as their status and message. run parses the arguments once for the
command and the failure both.
A server that restarts loses its sessions, and neorepl quietly gave the
next call a fresh one, in user, without the *1 or definitions the session
had, while pst and interrupt said there was no session by that name.
sessions/ensure! now calls back when it replaces one, which the CLI warns
about on stderr and the MCP tools put in their result, and the commands
that don't make one, pst, interrupt and sessions close among them, say the
session is gone. MCP's pst no longer makes a fresh one either.
An evaluation left running in a session, by a client that went away, say,
keeps the next one waiting, and a timeout then said interrupting the
evaluation failed, since the server answers that another one is running.
It now says the evaluation waits behind one from before, which
interrupting the session stops.
The server's reader places a missing paren as a line of the REPL, so
loading a file that doesn't balance said REPL:9:1, and a file that can't
be read got a raw exception. eval -f, load and the MCP load tool now check
the file the way neorepl check does, saying where it doesn't balance and
that check --fix repairs it, and that a file can't be read. macroexpand
says a form doesn't balance, rather than asking for one form.
The server's exception came through as "The server couldn't do eval" or
lookup and the whole of it. A namespace that isn't there now says so, from
nREPL's namespace-not-found, from the fallbacks that evaluate code, and
from nREPL's lookup, which only says lookup-error and gets the fallback
then. apropos checks the regex before it goes out. cider-nrepl answers
inspected code that throws with the whole stack trace, which comes down to
its first line and its root cause, as eval would say it.
@bbatsov
bbatsov merged commit 83a13be into main Oct 20, 2026
18 checks passed
@bbatsov
bbatsov deleted the errors-polish branch October 20, 2026 05:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant