-
Notifications
You must be signed in to change notification settings - Fork 43
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
Editorial: correct command return values #350
base: main
Are you sure you want to change the base?
Conversation
The "handle an incoming message" algorithm asserts that values returned by command algorithms always match the documented type: > 1. Let |result| be the result of running the [=remote end steps=] for > |command| given |session| and [=command parameters=] > |matched|["<code>params</code>"] > > 1. If |result| is an [=error=], then [=send an error response=] given > |connection|, |command id|, and |result|'s [=error code=], and finally > return. > > 1. Let |value| be |result|'s data. > > 1. Assert: |value| matches the definition for the [=result type=] > corresponding to the command with [=command name=] |method|. However, some algorithms which are documented to return the EmptyResult type instead return null. Update those algorithms to return an empty map in order to satisfy the assertion.
The "handle an incoming message" algorithm expects every command to return either a "success" value or an "error" value. > 1. Let |result| be the result of running the [=remote end steps=] for > |command| given |session| and [=command parameters=] > |matched|["<code>params</code>"] > > 1. If |result| is an [=error=], then [=send an error response=] given > |connection|, |command id|, and |result|'s [=error code=], and finally > return. > > 1. Let |value| be |result|'s data. Update the command algorithms to satisfy this expectation.
I thought I'd already fixed this by allowing the top-level algorithm to handle |
#351 is the alternative here. |
That makes the relevant commands just a little harder to interpret, since readers will have to learn that null is a special value which gets translated into something else. There may be a middle ground, though--one that isn't quite as wordy as what I've suggested so far and which also preserves the direct relationship between the return value and the data sent to the local end. What about: -1. Return [=success=] with data null.
+1. Return [=success=] with data set to an empty map. |
I think I thought I'd fixed this because we fixed it in the original WebDriver spec. I don't really mind either way between In either case #351 now has a fix for the description of remote end steps incorrectly claiming that they return something matching the result production directly when in fact it's always a success or error value. |
Editorial: correct command return value
The "handle an incoming message" algorithm expects every command to return either a "success" value or an "error" value.
Update the command algorithms to satisfy this expectation.
Editorial: return appropriate val. for EmptyResult
The "handle an incoming message" algorithm asserts that values returned by command algorithms always match the documented type:
However, some algorithms which are documented to return the EmptyResult type instead return null. Update those algorithms to return an empty map in order to satisfy the assertion.
Preview | Diff