File tree Expand file tree Collapse file tree 1 file changed +18
-1
lines changed
Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ extern crate postgres;
66use std:: cell:: RefCell ;
77use std:: collections:: LruCache ;
88use std:: default:: Default ;
9+ use std:: error;
910use std:: fmt;
1011use std:: mem;
1112use std:: rc:: Rc ;
@@ -26,6 +27,22 @@ impl fmt::Show for Error {
2627 }
2728}
2829
30+ impl error:: Error for Error {
31+ fn description ( & self ) -> & str {
32+ match * self {
33+ Error :: Connect ( _) => "Error opening a connection" ,
34+ Error :: Other ( _) => "Error communicating with server" ,
35+ }
36+ }
37+
38+ fn cause ( & self ) -> Option < & error:: Error > {
39+ match * self {
40+ Error :: Connect ( ref err) => Some ( err as & error:: Error ) ,
41+ Error :: Other ( ref err) => Some ( err as & error:: Error ) ,
42+ }
43+ }
44+ }
45+
2946pub struct PostgresPoolManager {
3047 params : Result < postgres:: ConnectParams , postgres:: ConnectError > ,
3148 ssl_mode : SslMode ,
@@ -153,7 +170,7 @@ impl GenericConnection for Connection {
153170 }
154171
155172 let stmt = Rc :: new ( try!( self . conn . prepare ( query[ ] ) ) ) ;
156- stmts. put ( query, stmt. clone ( ) ) ;
173+ stmts. insert ( query, stmt. clone ( ) ) ;
157174 Ok ( stmt)
158175 }
159176
You can’t perform that action at this time.
0 commit comments