Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Better explain or document how to detect when the error is 'row count' (tokio_postgres::Error) #1224

@ethereumdegen

Description

@ethereumdegen

... query_one ...

  ```
                    //doesnt work 
                 if pg_error.code().is_some_and( |e| e.eq(&tokio_postgres::error::SqlState::NO_DATA ) ) {
                    println!(" no data ");
                    return Ok(None);
                }

                //does work.. unfortunately..  insane but OK for now 
                   let error_str = format!("{:?}", pg_error);
                    if error_str.contains("RowCount") {

                        println!(" row count  ");

                        return Ok(None);
                    }

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