Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to throw exceptions on errors #4

Open
tpanningnextcen opened this issue Jun 27, 2014 · 2 comments
Open

Add option to throw exceptions on errors #4

tpanningnextcen opened this issue Jun 27, 2014 · 2 comments

Comments

@tpanningnextcen
Copy link

I'm using OpenCPU to incorporate R code into an existing application, and it needs to be able to handle OpenCPU errors internally instead of having them generate alerts or log to the console. For instance, when seturl() fails, it uses alert() to raise a dialog box. And as the connection is made, messages are logged with console.log().
When getting started, and in pages, the way opencpu.js uses alert() and console.log() is very helpful, so I still think that should be the default behavior. Would it be appropriate to create a flags on the ocpu object that tells it whether to use alert() or throw exceptions, and whether to log debug messages?
If this would be acceptable, I can submit a pull request.

@jeroen
Copy link
Member

jeroen commented Jun 27, 2014

For regular function calls, the error is already customizable using the jqxhr.fail callback. See for example http://jsfiddle.net/opencpu/MkAVF/.

You are right that the behavior of errors that happen while initiating the library is currently hardcoded. If you think this is undesirable and can suggest a neat way of configuring this, send a pull request and I'll have a look.

@tpanningnextcen
Copy link
Author

I've submitted a pull request for this issue #7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants