SWI-Prolog / packages-mqi

Machine Query Interface

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Need to find a way to return second argument of exceptions like error/2

EricZinda opened this issue · comments

Currently an exception like error(type_error(callable,1),context(textProgram/5,_987478)) in Prolog will be returned to Python as exception(type_error(callable,1)) since I have found the second argument often contains objects that can't be serialized over the wire. Currently the second argument is just removed, always.

Instead the language_server code should attempt to serialize the argument and, if it succeeds, send it. Only if it can't be it should be stripped. This is because the second argument often provides key context for where the error occurred (as in the above example) and without it, the user needs to go into standalone mode to figure out what the issue is.