How do I pass on "internal" errors to the user?
For example, if they try something and it says this in the console, can I capture that error and post it as a reportFeatureWarning?
Also, the documentation is pretty bad for try/throw/catch (for a non programmer). what is the "e" catch (e)? What does throwing "e" do?
Comments
-
eis a variable that holds whatever was thrown.Generally with
throw regenErroror similar, it is amapvalue with a message and some errorEntities.I've often used this in something like the below to make sure that errors come through to the user:
try { [...] } catch (err) { if (err is map) throw err; // it will already present nicely else throw regenError(toString(err)); }0 -
thank you, this is helpful. I will try it
0 -
If you want the error directly, you can also use processSubfeatureStatus with propagateErrorDisplay set to
true. This has the added benefit of giving you error bodies/highlighting from standard Onshape features (like a hole feature or a fillet). There is also callSubfeatureAndProcessStatus, which is just a more direct wrapper around processSubfeatureStatus.Software Developer at Epic SystemsFRC Design Mentor - Team 10553 Orange Overdrive0 -
incredible. this is great because the failed polyline or whatever stays visible and red, rather than disappearing. great!!
0



