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

Add support to provide more information for UnexpectedPageException #596

Closed
leonard84 opened this issue Oct 21, 2019 · 0 comments
Closed

Add support to provide more information for UnexpectedPageException #596

leonard84 opened this issue Oct 21, 2019 · 0 comments
Assignees
Labels
Milestone

Comments

@leonard84
Copy link

@leonard84 leonard84 commented Oct 21, 2019

Currently we only get the class name of the unexpected page as information,e.g.:
geb.error.UnexpectedPageException: An unexpected page com.acme.errors.ErrorPage was encountered when trying to find page match (given potentials: [class com.acme.HomePage, class com.acme.LoginPage])

In some instance it would be helpful to have the option to include additional information here.
I propose adding a new interface UnexpectedPage that has the method String getUnexpectedPageMessage() (feel free to use a better name) which is called after the page matches the at-checker. The String would then be included in the UnexpectedPageException message. Alternatively geb.Page could be extended with this method and provide a default implementation that returns null/"".

I know that there is the PageEventListener, but I think that this use-case still has merits, especially since you can't modify the exception message.

@erdi erdi self-assigned this Nov 22, 2019
@erdi erdi added the New feature label Nov 22, 2019
@erdi erdi added this to the 3.3 milestone Nov 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.