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

refactor: improve error message when sniper printer is set after building model #3694

Conversation

slarse
Copy link
Collaborator

@slarse slarse commented Nov 13, 2020

Fix #3693

The sniper printer must be set in the environment before building the model in order for the change collector (which is otherwise unnecessary overhead) to be attached. The error message you currently get if you set the sniper after building the model is uninformative to the uninitiated, and just says:

ChangeCollector was not attached to the environment

This PR augments that error message to say:

ChangeCollector was not attached to the environment. This typically means that the Sniper printer was set after building the model. It must be set before building the model.

I think this should be less confusing for non-expert users that run into this error (I was confused at first).

@slarse slarse changed the title wip: Add test case to showcase crash when sniper printer is attached after building model review: Improve error message on printing when Sniper printer is set after building model Mar 5, 2021
@slarse slarse changed the title review: Improve error message on printing when Sniper printer is set after building model review: Improve error message when sniper printer is set after building model Mar 5, 2021
@slarse
Copy link
Collaborator Author

slarse commented Mar 5, 2021

I'm not sure what tag (i.e. feat: doc: etc) to use in the PR title, so feel free to choose one that's appropriate!

@monperrus monperrus changed the title review: Improve error message when sniper printer is set after building model refactor: improve error message when sniper printer is set after building model Mar 6, 2021
@monperrus monperrus merged commit cbc3050 into INRIA:master Mar 6, 2021
@monperrus
Copy link
Collaborator

Thanks! Decided to go for a refactor: commit prefix: same behavior, but better for the developer.

@slarse slarse deleted the issue/3693-sniper-printer-crash-when-attached-after-building-model branch March 6, 2021 15:07
woutersmeenk pushed a commit to woutersmeenk/spoon that referenced this pull request Aug 29, 2021
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.

bug: Crash in SniperJavaPrettyPrinter.calculate if the printer is set after building the model
2 participants