Rhino.Compute error handling

Hi,

I’m using rhino.compute with the rhino3d appserver. When I send a solve request to compute it works fine except if the definition has any error. When there is an error in the definition the response that I get back from the fetch call only contains message and stack but not the actual values of the data that are defined in the RH_OUT: parameter. The error in the script should not affect the data stream to the RH_OUT: parameter, or at least it works fine when I run it locally on my desktop.

Do you know of any good way to get around this problem? Is the response supposed to contain the data even if there is an error thrown in the definition or does it have to be free from any errors to get a full response?

Thank you!

1 Like

Errors returned from Compute are dealt with rather simplistically in the AppServer.

Compute responds with the 500 status code if there are any errors in the solution. Maybe that’s a little heavy handed but it’s hard to define the cause of the error (bad input, bad file, incorrectly configured host machine, etc.).

The AppServer was developed as an example of how one might create an online parametric model viewer without exposing the Grasshopper files or the Compute instance running behind the scenes. The response from Compute should include the results regardless of success along with any component errors if there were any, however the AppServer is masking this. Perhaps, the AppServer could be improved to check to see if the 500 response contains any results and if so continue whilst logging the errors?

Thanks for your response @will .
We tried that and this is the result:

When running in GH we get results but there is an error that we have created. If successfull we get the data but in this case we only get the log as you see in the picture. As you see there is no value and this makes the program crash.

Try handling the response in the AppServer’s solve.js. By the time it gets to the client code, it’s already too late.

1 Like

Thanks man! This solved a LOT :smiley: