Skip to content

Throw CommandTimeoutExpired exception when query is cancelled #939

@bgrainger

Description

@bgrainger

Command timeouts are now implemented by first attempting to cancel the query server-side. If this succeeds, a MySqlException will be thrown with the code QueryInterrupted.

This proposes that the error code be changed to CommandTimeoutExpired, so it's uniform for whether soft- or hard-cancellation happens for a command timeout, and QueryInterrupted is used only for MySqlCommand.Cancel. This reverts the decision in #455 (comment):

If the server-side cancellation is successful, the Execute/Read/etc. method will throw a MySqlException with an ErrorCode set to MySqlErrorCode.QueryInterrupted. This is a change from current behaviour, which throws a MySqlException with MySqlErrorCode.CommandTimeoutExpired.

This change will restore the behaviour to how it was prior to 1.1.0. For clients that need to distinguish server-side vs client-side command timeout, an InnerException could hold the QueryInterrupted error code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions