{"action":"created","issue":{"url":"https://api.github.com/repos/sympy/csympy/issues/418","labels_url":"https://api.github.com/repos/sympy/csympy/issues/418/labels{/name}","comments_url":"https://api.github.com/repos/sympy/csympy/issues/418/comments","events_url":"https://api.github.com/repos/sympy/csympy/issues/418/events","html_url":"https://github.com/sympy/csympy/issues/418","id":64407094,"number":418,"title":"Figure out a way for exception handling with C wrappers","user":{"login":"abinashmeher999","id":6918379,"avatar_url":"https://avatars.githubusercontent.com/u/6918379?v=3","gravatar_id":"","url":"https://api.github.com/users/abinashmeher999","html_url":"https://github.com/abinashmeher999","followers_url":"https://api.github.com/users/abinashmeher999/followers","following_url":"https://api.github.com/users/abinashmeher999/following{/other_user}","gists_url":"https://api.github.com/users/abinashmeher999/gists{/gist_id}","starred_url":"https://api.github.com/users/abinashmeher999/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abinashmeher999/subscriptions","organizations_url":"https://api.github.com/users/abinashmeher999/orgs","repos_url":"https://api.github.com/users/abinashmeher999/repos","events_url":"https://api.github.com/users/abinashmeher999/events{/privacy}","received_events_url":"https://api.github.com/users/abinashmeher999/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2015-03-26T00:58:42Z","updated_at":"2015-03-30T18:14:35Z","closed_at":null,"body":"If the C++ function is wrapped with an `extern \"C\"` block, and is called as a C function, there doesn't seem to be a way to deal with the exceptions the underlying C++ function might throw. We should discuss what might be the proper approach for it? So that the ruby wrapper code throws the corresponding exceptions."},"comment":{"url":"https://api.github.com/repos/sympy/csympy/issues/comments/87777951","html_url":"https://github.com/sympy/csympy/issues/418#issuecomment-87777951","issue_url":"https://api.github.com/repos/sympy/csympy/issues/418","id":87777951,"user":{"login":"abinashmeher999","id":6918379,"avatar_url":"https://avatars.githubusercontent.com/u/6918379?v=3","gravatar_id":"","url":"https://api.github.com/users/abinashmeher999","html_url":"https://github.com/abinashmeher999","followers_url":"https://api.github.com/users/abinashmeher999/followers","following_url":"https://api.github.com/users/abinashmeher999/following{/other_user}","gists_url":"https://api.github.com/users/abinashmeher999/gists{/gist_id}","starred_url":"https://api.github.com/users/abinashmeher999/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abinashmeher999/subscriptions","organizations_url":"https://api.github.com/users/abinashmeher999/orgs","repos_url":"https://api.github.com/users/abinashmeher999/repos","events_url":"https://api.github.com/users/abinashmeher999/events{/privacy}","received_events_url":"https://api.github.com/users/abinashmeher999/received_events","type":"User","site_admin":false},"created_at":"2015-03-30T18:14:35Z","updated_at":"2015-03-30T18:14:35Z","body":"@certik Thanks for such a detailed explanation.\r\n Yeah, that's what I meant. But what I was thinking is since I am going to do it by hand, there won't be much changes to accommodate 2 from 1. Also, returning an error code is not always fool proof. We might need to set different unattainable values as error codes for different functions that return values like integers. However, we can still keep it while we use the same model in wrappers to catch and raise exceptions from C++ code.\r\n>so in Ruby and Python it's a good habit to return an exception rather than abort everything (though a lot of these \"input\" errors can be checked in the wrapper itself, e.g. if some function requires an integer > 1, you can check in the wrappers that the user provided an integer > 1 --- then if it aborts, it's a sign that there is a bug in the wrappers that should be fixed)\r\n\r\nAre you sure? because that way it will work but we need to do it everytime we write a wrapper. Also shouldn't it be a part of the same function?"}}