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

fix(web): handle parameter definition exceptions #976

Merged
merged 1 commit into from
Jan 23, 2022

Conversation

platypii
Copy link
Contributor

There is a UI bug when a user provides malformed parameter definitions. An exception is thrown internally, but the UI gets stuck with the message:

processing, please wait

This PR catches exceptions thrown inside the designParameters function. If an exception is thrown, it gets added to the status object so it can be displayed to the user. After applying this PR, the user message becomes more helpful:

ERROR: Definition of choice parameter (tooling) should include a 'values' parameter

Example script:

const { cuboid } = require("@jscad/modeling").primitives

function getParameterDefinitions() {
  return [{name: "tooling", type: "choice", caption: "Tooling"}] // Oops forgot "values"
}

function main(params) {
  return cuboid({})
}
module.exports = { getParameterDefinitions, main }

All Submissions:

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?
  • Does your submission pass tests?

@z3dev
Copy link
Member

z3dev commented Jan 18, 2022

@platypii This is great! So many users are still complaining about the stack traces, error messages, etc. This is going to help many many users. SUPER

@z3dev z3dev self-requested a review January 23, 2022 05:55
Copy link
Member

@z3dev z3dev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@platypii Thanks again. I reviewed the code, and tried the changes. This is a nice fix.

@z3dev z3dev merged commit bd82558 into jscad:master Jan 23, 2022
@platypii platypii deleted the parameter-exceptions branch January 23, 2022 06:04
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

Successfully merging this pull request may close these issues.

2 participants