Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf34ed1b

Browse files
Merge pull request#1262 from CobaltCause/push-sswwslomtkmm
fix an Error/Display impl
2 parentsbbd1301 +c5d3442 commitf34ed1b

File tree

5 files changed

+23
-45
lines changed

5 files changed

+23
-45
lines changed

‎tokio-postgres/src/error/mod.rs‎

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -379,31 +379,27 @@ impl fmt::Debug for Error {
379379
impl fmt::DisplayforError{
380380
fnfmt(&self,fmt:&mut fmt::Formatter<'_>) -> fmt::Result{
381381
match&self.0.kind{
382-
Kind::Io => fmt.write_str("error communicating with the server")?,
383-
Kind::UnexpectedMessage => fmt.write_str("unexpected message from server")?,
384-
Kind::Tls => fmt.write_str("error performing TLS handshake")?,
385-
Kind::ToSql(idx) =>write!(fmt,"error serializing parameter {idx}")?,
386-
Kind::FromSql(idx) =>write!(fmt,"error deserializing column {idx}")?,
387-
Kind::Column(column) =>write!(fmt,"invalid column `{column}`")?,
382+
Kind::Io => fmt.write_str("error communicating with the server"),
383+
Kind::UnexpectedMessage => fmt.write_str("unexpected message from server"),
384+
Kind::Tls => fmt.write_str("error performing TLS handshake"),
385+
Kind::ToSql(idx) =>write!(fmt,"error serializing parameter {idx}"),
386+
Kind::FromSql(idx) =>write!(fmt,"error deserializing column {idx}"),
387+
Kind::Column(column) =>write!(fmt,"invalid column `{column}`"),
388388
Kind::Parameters(real, expected) =>{
389-
write!(fmt,"expected {expected} parameters but got {real}")?
389+
write!(fmt,"expected {expected} parameters but got {real}")
390390
}
391-
Kind::Closed => fmt.write_str("connection closed")?,
392-
Kind::Db => fmt.write_str("db error")?,
393-
Kind::Parse => fmt.write_str("error parsing response from server")?,
394-
Kind::Encode => fmt.write_str("error encoding message to server")?,
395-
Kind::Authentication => fmt.write_str("authentication error")?,
396-
Kind::ConfigParse => fmt.write_str("invalid connection string")?,
397-
Kind::Config => fmt.write_str("invalid configuration")?,
398-
Kind::RowCount => fmt.write_str("query returned an unexpected number of rows")?,
391+
Kind::Closed => fmt.write_str("connection closed"),
392+
Kind::Db => fmt.write_str("db error"),
393+
Kind::Parse => fmt.write_str("error parsing response from server"),
394+
Kind::Encode => fmt.write_str("error encoding message to server"),
395+
Kind::Authentication => fmt.write_str("authentication error"),
396+
Kind::ConfigParse => fmt.write_str("invalid connection string"),
397+
Kind::Config => fmt.write_str("invalid configuration"),
398+
Kind::RowCount => fmt.write_str("query returned an unexpected number of rows"),
399399
#[cfg(feature ="runtime")]
400-
Kind::Connect => fmt.write_str("error connecting to server")?,
401-
Kind::Timeout => fmt.write_str("timeout waiting for server")?,
402-
};
403-
ifletSome(ref cause) =self.0.cause{
404-
write!(fmt,": {cause}")?;
400+
Kind::Connect => fmt.write_str("error connecting to server"),
401+
Kind::Timeout => fmt.write_str("timeout waiting for server"),
405402
}
406-
Ok(())
407403
}
408404
}
409405

‎tokio-postgres/tests/test/types/chrono_04.rs‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -171,10 +171,7 @@ async fn test_special_params_without_wrapper() {
171171
.unwrap()
172172
.try_get::<_,T>(0)
173173
.unwrap_err();
174-
assert_eq!(
175-
err.to_string(),
176-
"error deserializing column 0: value too large to decode"
177-
);
174+
assert_eq!(err.to_string(),"error deserializing column 0");
178175
}
179176

180177
letmut client =connect("user=postgres").await;

‎tokio-postgres/tests/test/types/jiff_01.rs‎

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -146,10 +146,7 @@ async fn test_special_params_without_wrapper() {
146146
.try_get::<_,T>(0)
147147
.unwrap_err();
148148

149-
assert_eq!(
150-
err.to_string(),
151-
"error deserializing column 0: value too large to decode"
152-
);
149+
assert_eq!(err.to_string(),"error deserializing column 0");
153150

154151
let err = client
155152
.query_one(&*format!("SELECT {val}::{sql_type}"),&[])
@@ -158,10 +155,7 @@ async fn test_special_params_without_wrapper() {
158155
.try_get::<_,T>(0)
159156
.unwrap_err();
160157

161-
assert_eq!(
162-
err.to_string(),
163-
"error deserializing column 0: value too large to decode"
164-
);
158+
assert_eq!(err.to_string(),"error deserializing column 0");
165159
}
166160

167161
letmut client =connect("user=postgres").await;

‎tokio-postgres/tests/test/types/jiff_02.rs‎

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -146,10 +146,7 @@ async fn test_special_params_without_wrapper() {
146146
.try_get::<_,T>(0)
147147
.unwrap_err();
148148

149-
assert_eq!(
150-
err.to_string(),
151-
"error deserializing column 0: value too large to decode"
152-
);
149+
assert_eq!(err.to_string(),"error deserializing column 0");
153150

154151
let err = client
155152
.query_one(&*format!("SELECT {val}::{sql_type}"),&[])
@@ -158,10 +155,7 @@ async fn test_special_params_without_wrapper() {
158155
.try_get::<_,T>(0)
159156
.unwrap_err();
160157

161-
assert_eq!(
162-
err.to_string(),
163-
"error deserializing column 0: value too large to decode"
164-
);
158+
assert_eq!(err.to_string(),"error deserializing column 0");
165159
}
166160

167161
letmut client =connect("user=postgres").await;

‎tokio-postgres/tests/test/types/time_03.rs‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -166,10 +166,7 @@ async fn test_special_params_without_wrapper() {
166166
.unwrap()
167167
.try_get::<_,T>(0)
168168
.unwrap_err();
169-
assert_eq!(
170-
err.to_string(),
171-
"error deserializing column 0: value too large to decode"
172-
);
169+
assert_eq!(err.to_string(),"error deserializing column 0");
173170
}
174171

175172
letmut client =crate::connect("user=postgres").await;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp