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
Currently, some errors, like those causes by improper (or buggy) use of clearVar, cause output to happen in stderr (I think). We could detect this in MATLAB with try-catch and return MATLAB incantation of Either. See here for a discussion on the issue of using try/catch, however.
So, other avenues of attack may need to be considered as well.
The text was updated successfully, but these errors were encountered:
I think #15 may provide a solution; we could ship a function tryToEither.m:
functionresult= tryToEither(fun, varargin)
result = struct('left', struct('message', 'tryToEither: try nor catch succeeded'));
try
funResult = fun(varargin{:});
result = struct('right', statementString);
catchex
result = struct('left', ex);
endend
Of course we may need a similar function shipped to create a function handle, haven't tested that yet (or seen any evidence of function handle support in the MATLAB Engine API).
Also, regarding Haskell-exceptions and errors, I'm guessing that foreign calls can't initiate an exception (at least not one that can be handled), unless we implement a wrapper as described above. One possible caveat might be: if the FFI call somehow called back into Haskell, and an exception was thrown in the Haskell code at that point.
Chessai says: i believe that the thread running the c code will just inherit whatever exception is thrown. you can catch them from haskell using the handlers in posix (which is not supported on windows). Minimalist segfaulting haskell program: https://gist.github.com/chessai/a9ae3d56b8f64ea6dce6065808fa3726
Possibly related: #10
Currently, some errors, like those causes by improper (or buggy) use of
clearVar
, cause output to happen in stderr (I think). We could detect this in MATLAB with try-catch and return MATLAB incantation ofEither
. See here for a discussion on the issue of using try/catch, however.So, other avenues of attack may need to be considered as well.
The text was updated successfully, but these errors were encountered: