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 to not have unneeded console errors #4482

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

jtran
Copy link
Collaborator

@jtran jtran commented Nov 13, 2024

We were logging errors when there were no actual problems. The variables pane is one place, but there are others.

This adds an optional variant of a function that was generating errors.

This also adds a Reason class that can be used in this pattern where you don't want to duplicate logic, but you also don't want to generate an error only to throw it away in the caller.

The root cause is the console.error() in our err() function.

Slack

Copy link

qa-wolf bot commented Nov 13, 2024

QA Wolf here! As you write new code it's important that your test coverage is keeping up.
Click here to request test coverage for this PR!

Copy link

vercel bot commented Nov 13, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
modeling-app ✅ Ready (Inspect) Visit Preview Nov 14, 2024 11:42pm

@lf94
Copy link
Contributor

lf94 commented Nov 13, 2024

Nice, but what happens when we do need the stack trace? new Reason(new Error().stack) ?

@jtran
Copy link
Collaborator Author

jtran commented Nov 13, 2024

You would not use Reason.

Comment on lines -101 to +102
} else if (!err(sg)) {
processedMemory[key] = sg.paths.map(({ __geoMeta, ...rest }: Path) => {
} else if (!(sk instanceof Reason)) {
processedMemory[key] = sk.paths.map(({ __geoMeta, ...rest }: Path) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

If you can assure me this is actually not an error, I'll approve this to add to our toolbox.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

What do you mean? The return type of sketchFromKclValueOptional() cannot return an error.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The point of this component is to display everything in memory in the UI. The only reason it checks for a sketch is so that it can be displayed differently from other types of values.

Copy link
Contributor

@lf94 lf94 left a comment

Choose a reason for hiding this comment

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

Looks good to me except the one thing I'd like to see before approving

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