-
Notifications
You must be signed in to change notification settings - Fork 23
$iErr = $_WD_ERROR_Exception
and re-ordering $_WD_ERROR_*
#438
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
Comments
I also propose to add new Global Enum _
$_WD_ERROR_Success = 0, _ ; No error
$_WD_ERROR_GeneralError, _ ; General error
$_WD_ERROR_NotSupported, _ ; When user try to use unsupported browser or capability
$_WD_ERROR_AlreadyDefined, _ ; Capability previously defined
$_WD_ERROR_SocketError, _ ; No socket
$_WD_ERROR_SendRecv, _ ; Send / Recv Error
$_WD_ERROR_SessionNotCreated, _ ; Session not created
$_WD_ERROR_ContextInvalid, _ ; Invalid browsing context
$_WD_ERROR_SessionInvalid, _ ; Invalid session ID was submitted to webdriver
$_WD_ERROR_UserAbort, _ ; In case when user abort when @error occurs and $_WD_ERROR_MSGBOX was set
$_WD_ERROR_Exception, _ ; Exception from web driver
$_WD_ERROR_InternalProcessing, _ ; The error comes from Internal processing
$_WD_ERROR_InvalidDataType, _ ; Invalid data type (IP, URL, Port ...)
$_WD_ERROR_InvalidValue, _ ; Invalid value in function-call
$_WD_ERROR_InvalidArgue, _ ; Invalid argument in function-call
$_WD_ERROR_Timeout, _ ; Connection / Send / Recv timeout
$_WD_ERROR_NoMatch, _ ; No match for _WDAction-find/search _WDGetElement...
$_WD_ERROR_NoAlert, _ ; No alert present when calling _WD_Alert
$_WD_ERROR_NotFound, _ ; File or registry key not found
$_WD_ERROR_RetValue, _ ; Error echo from Repl e.g. _WDAction("fullscreen","true") <> "true"
$_WD_ERROR_InvalidExpression, _ ; Invalid expression in XPath query, CSSSelector query or RegEx
$_WD_ERROR_ElementIssue, _ ; Problem interacting with element (click intercepted, etc)
$_WD_ERROR_UnknownCommand, _ ; Unknown command submitted to webdriver
$_WD_ERROR_FileIssue, _ ; Errors related to WebDriver EXE File
$_WD_ERROR_Javascript, _ ; Javascript error
$_WD_ERROR__COUNTER ; Defines row count for $aWD_ERROR_DESC |
The code you posted following this line is exactly the same as the code that you indicated is wrong. Please correct this to remove any confusion. |
Can you elaborate on how you would use this in each of these functions? Please be specific. |
OP edited |
comment to enums says $_WD_ERROR_Exception, _ ; Exception from web driver and it should comes only from so focusing on Local Const $sElement_CallingFrameBody = _WD_ExecuteScript($sSession, "return window.document.body;", Default, Default, $_WD_JSON_Element)
If Not @error Then
$vResult = __WD_FrameList_Internal($sSession, 'null', '', False, $_WD_DEBUG_Saved)
EndIf
#Region - post processing
If @error Then
$iErr = $_WD_ERROR_GeneralError
Else to: Local Const $sElement_CallingFrameBody = _WD_ExecuteScript($sSession, "return window.document.body;", Default, Default, $_WD_JSON_Element)
If Not @error Then
$vResult = __WD_FrameList_Internal($sSession, 'null', '', False, $_WD_DEBUG_Saved)
$iErr = @error
EndIf
#Region - post processing
If $iErr Then
If $iErr > $_WD_ERROR_Exception Then
$iErr = $_WD_ERROR_InternalProcessing
Endif
Else |
Comments are informational only. 😉 I would need to research before making decision on this.
Sorry, but I'm having trouble making sense of this. These are the questions I have thus far --
I initially envisioned that you wanted to use |
Ok we can forget about $_WD_ERROR_InternalProcessing What about reordering, and passing all main errors ? |
Please answer my earlier question --
|
not only comments, this following part also says: Global Const $aWD_ERROR_DESC[$_WD_ERROR__COUNTER] = [ _
...
"Webdriver Exception", _
... |
btw. ConsoleWrite("> wd_demo.au3: _WD_Startup" & @CRLF)
Local $iWebDriver_PID = _WD_Startup()
If _RunDemo_ErrorHander((@error <> $_WD_ERROR_Success), @error, @extended, $iWebDriver_PID, $sSession) Then Return
ConsoleWrite("> wd_demo.au3: _WD_CreateSession" & @CRLF)
MsgBox($MB_TOPMOST, "", ' BEFORE _WD_CreateSession - please close WebDriver Console window')
$sSession = _WD_CreateSession($sCapabilities)
MsgBox($MB_TOPMOST, "", ' AFTER _WD_CreateSession')
Exit my result was:
and my question are: What was a reason for Do any other function return |
I think the idea was to limit the number of error codes that the calling routine would need to handle. Do you think a user script would need to distinguish between
It's certainly possible if the function simply returns the error code coming from __WD_Get/Put/Delete without overriding it. |
firstly Capabilities must be created - this following @error are related to creating capabilities
then Session must be created - this following @error are related to creating scession
this following @error are related to communication issues between UDF and WebDriver
All other @error are related in some way to USER actions or ENV |
that's what I thought
Yes.
When user had already properly created connection, and all was working fine be first few minutes of proccessing then something happen and user get error |
For example I intentionally removed
As you see that |
From a debugging perspective, I agree that having the correct error code is essential, and we already have that in the logs when the correct debugging level is set. My question was regarding user scripts and whether the script would benefit by having multiple error codes returned. After calling |
Normally I would build a wrapper for checking error which will show some kind of MSGBOX dialog with error information like: or I would just reinitialize connection. |
I have few script that in case of errors are trying to repeat processsing, but as so far I never checks for the case if session is still valid, or if other In other words, I have a feelling that currently when you get
so after getting |
Am I right ? |
How these errors (not bugs 😛) are handled in a script is a design decision, so there isn't a right or wrong answer here. |
As I mentioned before, comments are informational only and shouldn't be interpreted as absolute. For example, the comments associated to |
To summarize your request --
|
we should review these comments and change them as they are currently causing confusion |
I'm fine with this. If you want and if you find some spare time can you provide PR ?
Thanks. I will follow your advice. |
I wonder if you anywhere had a need to check after the error |
No, this isn't something that I've done to date.
It would be simple to change that specific comment to "Unsupported option". Which others do you find confusing? |
So finally we have
And #447 |
Uh oh!
There was an error while loading. Please reload this page.
Feature request
Is your feature request related to a problem?
there is many places where UDF uses such template:
IMO this is wrong,
At least this enums should be passed to the main script
IMO they are main/general errors which can occrus when webdriver, browser, session is closed, and in such case reporting just:
$_WD_ERROR_Exception
is a big a misunderstanding/mistake/oversight, even if they came from some internal processing.Describe the solution you'd like
we should reorder enums $WD_ERROR* like this:
to have possiiblity to use code like this:
Describe alternatives you've considered
we can create separate internal function which will check desired cases and set
$iErr
accordingly.Additional context
none
The text was updated successfully, but these errors were encountered: