diff options
author | Eli W. Hunter <42009212+elihunter173@users.noreply.github.com> | 2020-07-23 23:54:12 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-23 23:54:12 -0400 |
commit | 6cd1d7f93bd6f150341582a1b54087cefffdbf87 (patch) | |
tree | 88c109ec79e679d5aa041b20f074cf7b57d97cda /src/errors.rs | |
parent | a4cd2185976ad56b880d5a10374c4dee6d116e6a (diff) |
Async/Await Support (continuation of #191) (#229)
* it builds!
* remove unused dependencies
* bump dependencies
* reimplement 'exec' endpoint
* update a few more examples
* update remaining examples
* fix doc tests, remove unused 'read' module
* remove feature-gated async closures
* split futures dependency to just 'futures-util'
* update version and readme
* make functions accepting Body generic over Into<Body> again
* update changelog
* reinstate 'unix-socket' feature
* reinstate 'attach' endpoint
* fix clippy lints
* fix documentation typo
* fix container copyfrom/into implementations
* add convenience methods for TtyChunk struct
* remove 'main' from code example to silence clippy lint
* Update hyper to 0.13.1
* Add Send bounds to TtyWriter
* Appease clippy
* Fix examples
* Update issue in changelog
Co-authored-by: Daniel Eades <danieleades@hotmail.com>
Co-authored-by: Marc Schreiber <marc.schreiber@aixigo.de>
Diffstat (limited to 'src/errors.rs')
-rw-r--r-- | src/errors.rs | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/src/errors.rs b/src/errors.rs index 5506198..9d01f91 100644 --- a/src/errors.rs +++ b/src/errors.rs @@ -1,8 +1,10 @@ //! Representations of various client errors -use hyper::{self, StatusCode}; +use hyper::{self, http, StatusCode}; use serde_json::Error as SerdeError; -use std::{error::Error as StdError, fmt, io::Error as IoError, string::FromUtf8Error}; +use std::{error::Error as StdError, fmt, string::FromUtf8Error}; + +use futures_util::io::Error as IoError; #[derive(Debug)] pub enum Error { @@ -34,12 +36,25 @@ impl From<hyper::http::Error> for Error { } } +impl From<http::uri::InvalidUri> for Error { + fn from(error: http::uri::InvalidUri) -> Self { + let http_error: http::Error = error.into(); + http_error.into() + } +} + impl From<IoError> for Error { fn from(error: IoError) -> Error { Error::IO(error) } } +impl From<FromUtf8Error> for Error { + fn from(error: FromUtf8Error) -> Error { + Error::Encoding(error) + } +} + impl fmt::Display for Error { fn fmt( &self, |