EnhancedBrowserException class
An enhanced browser exception that provides additional context about failed operations.
This exception extends BrowserException to include more detailed information about the context in which the error occurred, including the selector being used, the action being performed, and optionally a screenshot path for debugging.
This enhanced exception is particularly useful for debugging browser test failures as it provides more context than the basic BrowserException.
Example:
throw EnhancedBrowserException(
'Element not found',
selector: '#submit-button',
action: 'click',
screenshotPath: 'test_screenshots/failure_123.png',
);
- Inheritance
-
- Object
- BrowserException
- EnhancedBrowserException
Constructors
- EnhancedBrowserException(String message, {String? selector, String? action, String? screenshotPath, String? details, dynamic cause})
- Creates an EnhancedBrowserException with additional context information.
Properties
- action → String?
-
The action that was being performed when the error occurred (e.g., 'click', 'type', 'wait').
final
- cause → dynamic
-
The underlying error or exception that caused this BrowserException, if any.
finalinherited
- details → String?
-
Additional details about the error context.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- message → String
-
A message describing the error.
finalinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- screenshotPath → String?
-
The path to a screenshot captured when the error occurred, if available.
final
- selector → String?
-
The CSS selector or element identifier that was being used when the error occurred.
final
Methods
-
copyWith(
{String? message, String? selector, String? action, String? screenshotPath, String? details, dynamic cause}) → EnhancedBrowserException - Creates a copy of this exception with updated context information.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
Returns a detailed string representation of the exception including all context information.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited