-
Notifications
You must be signed in to change notification settings - Fork 566
fix: Improve navigate_page_history error messages #321
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
base: main
Are you sure you want to change the base?
Conversation
Check navigation result and provide specific feedback: - Detect when no previous/next page exists in history - Show timeout errors with duration details - Include actual error messages instead of generic text
Fixes: #259 |
result = await page.goForward(options); | ||
} | ||
|
||
// If result is null, navigation wasn't possible (no history) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is not correct. Successful navigations could result in a null result if the navigation has no network request. We fixed Puppeteer in puppeteer/puppeteer#14160 to throw an error when there is no history. So the null result, should be treated as a successful navigation.
} | ||
} catch { | ||
response.appendResponseLine( | ||
`Unable to navigate ${request.params.navigate} in currently selected page.`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be sufficient to add the error.message to this message and revert other changes
Problem
The
navigate_page_history
tool previously suppressed allnavigation errors with a generic message: "Unable to
navigate {back|forward} in currently selected page." This
provided no context about why the navigation failed, making
it difficult for users to understand whether:
Solution
Enhanced error handling to provide specific, actionable
feedback:
from
goBack()
/goForward()
to detect when navigation isimpossible
null
, return:"Cannot navigate back, no previous page in history."
out after 30000ms."
generic text
Changes
navigate_page_history
handler insrc/tools/pages.ts
Testing
first page
end of history