Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.

First time visiting? Here are some places to start:
  1. Looking for a certain topic? Check out the categories filter or use Search (upper right).
  2. Need support? Ask a question to our Community Support category.
  3. Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
  4. Be respectful, on topic and if you see a problem, Flag it.

If you would like to contact our Community Manager personally, feel free to send a private message or an email.

How do I pass on "internal" errors to the user?

joshtargojoshtargo Member Posts: 419 EDU

For example, if they try something and it says this in the console, can I capture that error and post it as a reportFeatureWarning?

image.png

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?

2025-08-31 16 42 17.png

Comments

  • MBartlett21MBartlett21 Member, OS Professional, Developers Posts: 2,060 ✭✭✭✭✭
    edited 2:52AM

    e is a variable that holds whatever was thrown.

    Generally with throw regenError or similar, it is a map value 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));
    }
    
    mb - draftsman - also FS author: View FeatureScripts
    IR for AS/NZS 1100
Sign In or Register to comment.