au3WebDriver icon indicating copy to clipboard operation
au3WebDriver copied to clipboard

Enums for @extended values?

Open Danp2 opened this issue 3 years ago • 14 comments

Feature request

Some existing WD UDFs set @extended to indicate more details on the type of error that occurred. They currently use "magic" numbers instead of a constant.

Describe the solution you'd like

Add a Global Enum to define these values

Describe alternatives you've considered

Do nothing

Additional context

None

Danp2 avatar Feb 26 '22 19:02 Danp2

Can we use @scriptlinenumber ?

mlipok avatar Mar 11 '22 21:03 mlipok

You mean instead of Enums? I don't know if that's a good idea. This wouldn't work with compiled scripts, right?

Danp2 avatar Mar 11 '22 21:03 Danp2

Yeah.

mlipok avatar Mar 11 '22 21:03 mlipok

Today I came to the issue: _WD_UpdateDriver ==> Browser or feature not supported (19 / 21) : DriverCurrent = : DriverLatest =

It was really easy to find:

$iExt = 21 ; $iExt from 21 to 29 are related to _WD_GetBrowserPath()

So generally as to question: Enums for @extended values? Answer is: No

So I vote to close this issue.

mlipok avatar Mar 29 '22 11:03 mlipok

So generally as to question: Enums for @Extended values? Answer is: No

So I vote to close this issue.

@Danp2 your decision or comment?

mlipok avatar Apr 05 '22 21:04 mlipok

My concern still exists regarding the use of "magic" numbers. Your coding revisions have proved this exact point by changing the value of $iExt over time in some functions.

What happens when the calling script starts checking for @extended = 21 (from your example above), and then you internally change 21 to some other arbitrary number?

Danp2 avatar Apr 05 '22 22:04 Danp2

@mlipok Any thoughts on my last comment above?

Danp2 avatar Apr 08 '22 14:04 Danp2

A warrning should be added to the top of UDF When $iExt is set to a raw number do not treat them as static value, because they may change in the future. This is only a way of finding point where or why the script exits (returns from function). Because of this reason you can store this value or manually checking in investigation, but do not rely on them in your script runtime.

mlipok avatar May 30 '22 21:05 mlipok

Not crazy about that idea. Will need to think about it.

Danp2 avatar May 30 '22 22:05 Danp2

Will need to think about it.

It's not a problem, he's been waiting for almost two months, so he'll wait for the next one.

mlipok avatar May 30 '22 22:05 mlipok

What you think about this kind of simultaneous use: ($iExt + $sMessage usage)

mlipok avatar Jun 08 '22 16:06 mlipok

What you think about this kind of simultaneous use

You may want to elaborate as to what you mean by "simultaneous use".

Danp2 avatar Jun 08 '22 16:06 Danp2

to use $sMessage together with $iExt. For example _WD_GetBrowserPath() sets $iExt but is not using $sMessages.

Mabye we should review $iExt usage and add for each of them also $sMessages ?

mlipok avatar Jun 08 '22 16:06 mlipok

These parameters ($iExt and $sMessages) are optional, and they can be supplied independently. You can review existing functions and add $sMessages if you desire, but it isn't required.

Danp2 avatar Jun 08 '22 17:06 Danp2

I like the current implementation. I think that from about a year there was no any issue with this. so IMHO we can close this issue.

mlipok avatar Jan 29 '23 23:01 mlipok