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

Appearance settings

Commit ff595b8

Browse filesBrowse files
committed
up pg version
1 parent fdbc228 commit ff595b8
Copy full SHA for ff595b8

File tree

Expand file treeCollapse file tree

3 files changed

+16
-2
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+16
-2
lines changed

‎rbdc-pg/Cargo.toml

Copy file name to clipboardExpand all lines: rbdc-pg/Cargo.toml
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "rbdc-pg"
3-
version = "4.5.18"
3+
version = "4.5.19"
44
edition = "2021"
55
description = "The Rust SQL Toolkit and ORM Library. An async, pure Rust SQL crate featuring compile-time Dynamic SQL"
66
readme = "Readme.md"

‎rbdc-pg/src/connection/stream.rs

Copy file name to clipboardExpand all lines: rbdc-pg/src/connection/stream.rs
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ use crate::options::PgConnectOptions;
1313
use rbdc::error::Error;
1414
use rbdc::io::{BufStream, Decode, Encode};
1515
use rbdc::net::{MaybeTlsStream, Socket};
16+
use crate::error::PgDatabaseError;
1617
// the stream is a separate type from the connection to uphold the invariant where an instantiated
1718
// [PgConnection] is a **valid** connection to postgres
1819

@@ -101,7 +102,7 @@ impl PgStream {
101102
MessageFormat::ErrorResponse => {
102103
// An error returned from the database server.
103104
let notice = message.decode::<Notice>()?;
104-
return Err(Error::from(format!("db:code={},message={}", notice.code(), notice.message())));
105+
return Err(PgDatabaseError::from(notice).into());
105106
}
106107

107108
MessageFormat::NotificationResponse => {

‎rbdc-pg/src/error.rs

Copy file name to clipboardExpand all lines: rbdc-pg/src/error.rs
+13Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,3 +158,16 @@ impl Display for PgDatabaseError {
158158
}
159159

160160
impl Error for PgDatabaseError {}
161+
162+
163+
impl From<Notice> for PgDatabaseError {
164+
fn from(notice: Notice) -> Self {
165+
PgDatabaseError(notice)
166+
}
167+
}
168+
169+
impl From<PgDatabaseError> for rbs::Error {
170+
fn from(err: PgDatabaseError) -> Self {
171+
rbs::Error::from(format!("{}:{}",err.code(), err.message()))
172+
}
173+
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.