Skip to content

Commit ea45cef

Browse files
committed
Update error checking example
1 parent e83e64c commit ea45cef

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,9 +160,10 @@ methods, there is a second variant prefixed with `try_` which returns a
160160
match conn.try_execute(query, params) {
161161
Ok(updates) => println!("{} rows were updated", updates),
162162
Err(err) => match err.code {
163-
NotNullViolation => println!("Something was NULL that shouldn't be"),
164-
SyntaxError => println!("Invalid query syntax"),
165-
_ => println!("A bad thing happened: {}", err.message),
163+
PgDbError(NotNullViolation) =>
164+
println!("Something was NULL that shouldn't be"),
165+
PgDbError(SyntaxError) => println!("Invalid query syntax"),
166+
_ => println!("A bad thing happened: {}", err),
166167
}
167168
}
168169
```

0 commit comments

Comments
 (0)