From 8dc6d74a1c378768392cf0dc81ae0c17c0a3d230 Mon Sep 17 00:00:00 2001 From: Andreas Tolfsen Date: Mon, 8 Jun 2015 15:57:35 +0100 Subject: [PATCH] correct uses of error fields MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit An error is a JSON Object with the "error", "message", and "stacktrace" fields. Reflect this in the redefined commands and the document’s data model. --- webdriver-spec.html | 75 +++++++++++++++++++++++++++------------------ 1 file changed, 46 insertions(+), 29 deletions(-) diff --git a/webdriver-spec.html b/webdriver-spec.html index 132dbd05a..5baa29af8 100644 --- a/webdriver-spec.html +++ b/webdriver-spec.html @@ -250,12 +250,12 @@

Processing Model

  • Let parse result be the result of parsing as JSON with request's body as the argument.

  • -
  • If parse result is an error or if it is a success but its associated data is not an Object object, send an error with status error code invalid argument and jump back to step 1 in this overall algorithm.

    +
  • If parse result is an error or if it is a success but its associated data is not an Object object, send an error with error code invalid argument and jump back to step 1 in this overall algorithm.

    Otherwise, let parameters beparse result's data.

  • -

    Otherwise, let parameters be null

    +

    Otherwise, let parameters be null.

  • Let response data be a command response object obtained by running the remote end steps for command with arguments element id and parameters.

  • @@ -267,24 +267,43 @@

    Processing Model

  • Jump to step 1.

  • -

    When required to send an error, with error code, a remote end must run the following steps:

    +

    When required to send an error, + with error code, + a remote end must run the following steps:

    -
      -
    1. Let http status and name be the error response data for error code.

    2. -
    3. Let data be a new JSON Object.

      - -
    4. Let message be an implementation-defined string containing a human-readable description of the reason for the error.

    5. +
        +
      1. Let http status and name + be the error response data for error code. -

      2. Let stacktrace be an implementation-defined string containing a stack trace report of the active stack frames at the time when the error occurred.

      3. +
      4. Let message be an implementation-defined string + containing a human-readable description of the reason for the error. - -

      5. Set the properties of data with values ("error", name), ("message", message).

      6. +
      7. Let stacktrace be an implementation-defined string + containing a stack trace report of the active stack frames + at the time when the error occurred. -

      8. Send a response with status and data as arguments.
      9. + +
      10. Let data be a new JSON Object + initialised with the following properties: + +

        +
        "error" +
        Value of name. + +
        "message" +
        Value of message. + +
        "stacktrace" +
        Value of stacktrace. +
        -
      +
    6. Send a response with status + and data as arguments.

    7. +
    -

    When required to send a response, with arguments status and data, a remote end must run the following steps:

    +

    When required to send a response, + with arguments status and data, + a remote end must run the following steps:

    1. Let response be a new response.

    2. @@ -580,24 +599,25 @@

      List of Endpoints

      Handling Errors

      -

      Errors are represented in the WebDriver protocol with a HTTP response with a HTTP status in the 4xx or 5xx range and a JSON body containing details of the error. This JSON body has two fields: error, containing a string indicating the error type and error containing an implementation-defined string containing a human readable description of the kind of error that occured.

      +

      Errors are represented in the WebDriver protocol with a HTTP response with a HTTP status in the 4xx or 5xx range and a JSON body containing details of the error. This JSON body has three fields: error, containing a string indicating the error type; message, containing an implementation-defined string with a human readable description of the kind of error that occured; and stacktrace, containing an implementation-defined string with a stack trace report of the active stack frames at the time when the error occurred.

      -

      The following table lists each error code, its associated HTTP status, JSON status, and a non-normative description of the error. The error response data for a particular error code is the values of the HTTP Status and JSON Status columns for the row corresponding to that error code.

      +

      The following table lists each error code, its associated HTTP status, JSON error code, and a non-normative description of the error. The error response data for a particular error code is the values of the HTTP Status and JSON Error Code columns for the row corresponding to that error code.

      - + @@ -1139,8 +1159,7 @@

      Set Timeout

      Set the session script timeout to timeout milliseconds.

      Otherwise:
      -

      Return error with status invalid - argument.. +

      Return an invalid argument error.

    3. Return success with data null.
    4. @@ -1718,9 +1737,8 @@

      Switch to Frame

      Otherwise if id is a Number object:

        -
      1. If id is less than 0 or greater than - 216 - 1, return error with status no - such frame.

      2. +
      3. If id is less than 0 or greater than 216 - 1, + return a no such frame error.

      4. Let window be the associated window of the current browsing @@ -1729,7 +1747,7 @@

        Switch to Frame

      5. If id is not a supported property index of window, - return error with status no such frame.

      6. + return no such frame error.
      7. Let child window be the WindowProxy object obtained by determining @@ -1745,16 +1763,15 @@

        Switch to Frame

      8. Let element be the element represented by id.

      9. If element is not a frame - or iframe element, return error with - status no such frame.

      10. + or iframe element, + return a no such frame error.
      11. Set the current browsing context to element's nested browsing context.

      Otherwise:

        -
      1. Return error with status no such - frame.

      2. +
      3. Return no such frame error.

    5. Return success with data null.

    6. Error Code HTTP StatusJSON StatusJSON Error Code Description