Skip to content

The "complete-doc" op lacks error handling #294

@sanjayl

Description

@sanjayl

There's no exception handling around the complete-doc op in the cider.nrepl.middleware.completion middleware. The propagated exception hangs my environment.

Reproducible by passing in an empty string as the symbol (or leaving out that kv pair entirely), so probably just an in vitro situation:

(require '[cider.nrepl.test-session :as session])
(session/session-fixture #(session/message {:op "complete-doc" :symbol ""}))

Repeat of #180?

After having this fail in the cider-repl, the system seems to get pretty hangy; more so than when it blows up the test runner (although that might just be my imagination). The messages are attached below in case there is infact something weird.

Is there a way to pull out the *-reply from each middleware and standardize it with guaranteed error checking? Maybe something like (comms/reply [msg response & error]?? You'd pass in the msg, a closure to build the reply, and an optional closure to build a custom error packet, executed with a try/catch? Apologies if it already exists or is impossible; I'm extremely new to the codebase.

(---> 
  ns  "user"
  op  "eval"
  session  "aa478078-a963-43cd-a7c3-540bd5bd9ddc"
  code  "(session/session-fixture #(session/message {:op \"complete-doc\" :symbol \"\"}))\n"
  file  "*cider-repl cider-nrepl*"
  line  4
  column  6
  id  "10"
)
(<- 
  err  "ERROR: Unhandled REPL handler exception processing message {:id 6b48f63c-8c85-480c-ba93-e34d47f7925c, :op complete-doc, :session 4a6a45e0-84fa-4469-8095-89242cebfb66, :symbol }\n"
  id  "10"
  session  "aa478078-a963-43cd-a7c3-540bd5bd9ddc"
)
(---> 
  op  "interrupt"
  session  "aa478078-a963-43cd-a7c3-540bd5bd9ddc"
  interrupt-id  "8"
  id  "11"
)
(---> 
  op  "interrupt"
  session  "aa478078-a963-43cd-a7c3-540bd5bd9ddc"
  interrupt-id  "7"
  id  "12"
)
(---> 
  op  "interrupt"
  session  "aa478078-a963-43cd-a7c3-540bd5bd9ddc"
  interrupt-id  "10"
  id  "13"
)
(---> 
  op  "interrupt"
  session  "aa478078-a963-43cd-a7c3-540bd5bd9ddc"
  interrupt-id  "5"
  id  "14"
)
(<- 
  id  "11"
  session  "aa478078-a963-43cd-a7c3-540bd5bd9ddc"
  status  ("done" "interrupt-id-mismatch" "error")
)
(<- 
  id  "12"
  session  "aa478078-a963-43cd-a7c3-540bd5bd9ddc"
  status  ("done" "interrupt-id-mismatch" "error")
)
(<- 
  id  "10"
  session  "aa478078-a963-43cd-a7c3-540bd5bd9ddc"
  status  ("interrupted")
)
(<- 
  id  "13"
  session  "aa478078-a963-43cd-a7c3-540bd5bd9ddc"
  status  ("done")
)
(<- 
  id  "14"
  session  "aa478078-a963-43cd-a7c3-540bd5bd9ddc"
  status  ("done" "interrupt-id-mismatch" "error")
)
(<- 
  id  "10"
  session  "aa478078-a963-43cd-a7c3-540bd5bd9ddc"
  status  ("done")
)
(<- 
  changed-namespaces  (dict)
  id  "10"
  repl-type  "clj"
  session  "aa478078-a963-43cd-a7c3-540bd5bd9ddc"
  status  ("state")
)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions