feat(error): add Ssl variant to hyper::Error
The errors from openssl were previously boxed into a Box<std::error::Error>, which lost some specifics and made it difficult to match against. To solve this, an `Ssl` variant is added to the `Error` enum of hyper, and is returned when openssl returns specific errors. Closes #483 BREAKING CHANGE: Adds a variant to `hyper::Error`, which may break any exhaustive matches.
This commit is contained in:
@@ -73,7 +73,7 @@ pub struct MockConnector;
|
||||
impl NetworkConnector for MockConnector {
|
||||
type Stream = MockStream;
|
||||
|
||||
fn connect(&mut self, _host: &str, _port: u16, _scheme: &str) -> io::Result<MockStream> {
|
||||
fn connect(&mut self, _host: &str, _port: u16, _scheme: &str) -> ::Result<MockStream> {
|
||||
Ok(MockStream::new())
|
||||
}
|
||||
}
|
||||
@@ -88,7 +88,7 @@ macro_rules! mock_connector (
|
||||
|
||||
impl ::net::NetworkConnector for $name {
|
||||
type Stream = ::mock::MockStream;
|
||||
fn connect(&mut self, host: &str, port: u16, scheme: &str) -> ::std::io::Result<::mock::MockStream> {
|
||||
fn connect(&mut self, host: &str, port: u16, scheme: &str) -> $crate::Result<::mock::MockStream> {
|
||||
use std::collections::HashMap;
|
||||
use std::io::Cursor;
|
||||
debug!("MockStream::connect({:?}, {:?}, {:?})", host, port, scheme);
|
||||
@@ -99,7 +99,7 @@ macro_rules! mock_connector (
|
||||
let key = format!("{}://{}", scheme, host);
|
||||
// ignore port for now
|
||||
match map.get(&*key) {
|
||||
Some(res) => Ok(::mock::MockStream {
|
||||
Some(res) => Ok($crate::mock::MockStream {
|
||||
write: vec![],
|
||||
read: Cursor::new(res.to_string().into_bytes()),
|
||||
}),
|
||||
|
||||
Reference in New Issue
Block a user