You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
(defnweighted-average
[weights values]
(if (and (or (list? weights) (vector? weights))
(or (list? values) (vector? values)))
(if (= (count weights) (count values))
(let [weighted-sum (reduce + (map * weights values))]
(/ weighted-sum (reduce + weights)))
(throw (ex-info"The number of weights must equal the number of values."
{:weights weights
:values values})))
(throw (ex-info"The weights and values must be lists or vectors."
{:weights weights
:values values}))))
If I evaluate this from my editor or the output window, the evaluation seems to never return. I cannot evaluate anything else and get a result, either. Interrupting the eval doesn't seem to work.
However, in the nrepl logs, I see the expected exception (at the bottom of the function) is returned after I eval the call to the function. It just never appears in the output window or in the editor.
A friend of mine can eval the call in emacs and see the expected exception without any issue.
nrepl logs:
-> sent
{
id: '196',
op: 'eval',
session: 'f5d05f33-b88a-4640-82c9-98ed61dc9298',
code: '(weighted-average [1 2 3] (range))',
file: '<file-path>/core.clj',
line: 34,
column: 3,
stdout: [Function: stdout],
stderr: [Function: stderr],
pprint: true
}
<- received
{
err: 'Execution error (ExceptionInfo) at <namespace>/weighted-average (core.clj:27).\n' +
'The weights and values must be lists or vectors.\n',
id: '196',
session: 'f5d05f33-b88a-4640-82c9-98ed61dc9298'
}
<- received
{
ex: 'class clojure.lang.ExceptionInfo',
id: '196',
'root-ex': 'class clojure.lang.ExceptionInfo',
session: 'f5d05f33-b88a-4640-82c9-98ed61dc9298',
status: [ 'eval-error' ]
}
<- received
{
id: '196',
session: 'f5d05f33-b88a-4640-82c9-98ed61dc9298',
status: [ 'done' ]
}
The text was updated successfully, but these errors were encountered:
I went back to Calva version 2.0.219 and the problem is reproducible in that version too. Another thing to note is that soon after the "done" message for the eval that throws the exception, messages stop being "received" from nrepl (at least as far as the logs show). When I try to eval something, or hover over something, the messages sent don't have any responses.
A message or two immediately after the eval of the function call do have responses returned, but after that, no responses.
Problem also happens back in 2.0.216. If I just write a function that calls (throw (ex-info ... and call it, Calva shows me the error. It's something specific with the code I posted.
With this code:
If I evaluate this from my editor or the output window, the evaluation seems to never return. I cannot evaluate anything else and get a result, either. Interrupting the eval doesn't seem to work.
However, in the nrepl logs, I see the expected exception (at the bottom of the function) is returned after I eval the call to the function. It just never appears in the output window or in the editor.
A friend of mine can eval the call in emacs and see the expected exception without any issue.
nrepl logs:
The text was updated successfully, but these errors were encountered: