robotframework-browser icon indicating copy to clipboard operation
robotframework-browser copied to clipboard

Add Custom Exception Classes to BrowserLibrary for User Code to Catch

Open TWijesundera opened this issue 1 year ago • 3 comments

Currently, browser library throws an AssertionError for every keyword that fails due to timeout or assertion issues. IMO this is too broad and BrowserLibrary should raise custom exceptions for user code to catch so we can be certain that BrowserLibrary is raising an error and not other parts of the testing suite.

This practice is common with other python libraries: https://requests.readthedocs.io/en/latest/_modules/requests/exceptions/

TWijesundera avatar Dec 11 '23 15:12 TWijesundera

We need to discuss this with the team. I understand your needs but I am not sure how we can do this with Assertion Engine

@allcontributors please add @TWijesundera for ideas

aaltat avatar Dec 11 '23 16:12 aaltat

@aaltat

I've put up a pull request to add @TWijesundera! :tada:

allcontributors[bot] avatar Dec 11 '23 16:12 allcontributors[bot]

I think you don't need to worry about assertion engine. You could probably transform the AssertionError raised by assertion engine into some other exception class

TWijesundera avatar May 02 '24 01:05 TWijesundera

I do agree that this would be useful, but most likely this is not implemented foreseen future. It is just too backwards incompatible for my mind and bang for the bug is not there. Therefore closing this issue.

aaltat avatar Oct 25 '24 20:10 aaltat