This repository has been archived by the owner on Sep 8, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
292 additions
and
333 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
[workspace] | ||
members = ["./glitch-in-the-matrix", "./gm-types", "./gm-boilerplate"] | ||
members = ["./glitch-in-the-matrix", "./gm-types"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,5 @@ | ||
[package] | ||
authors = [ | ||
"eeeeeta <[email protected]>", | ||
"digital <[email protected]>" | ||
] | ||
authors = ["eeeeeta <[email protected]>", "digital <[email protected]>"] | ||
description = "A set of matrix.org bindings for Rust." | ||
documentation = "http://docs.rs/glitch-in-the-matrix" | ||
homepage = "https://github.com/eeeeeta/glitch-in-the-matrix" | ||
|
@@ -11,19 +8,26 @@ license = "CC0-1.0" | |
name = "glitch-in-the-matrix" | ||
readme = "../README.md" | ||
repository = "https://github.com/eeeeeta/glitch-in-the-matrix" | ||
version = "0.13.1" | ||
version = "0.14.0" | ||
|
||
[dependencies] | ||
failure = "0.1" | ||
failure_derive = "0.1" | ||
futures = "0.1" | ||
hyper = "0.11" | ||
hyper-openssl = "0.3" | ||
percent-encoding = "1.0" | ||
serde = "1.0" | ||
serde_json = "1.0" | ||
tokio-core = "0.1" | ||
percent-encoding = "1.0" | ||
gm-types = { path = "../gm-types", version = "0.3.1" } | ||
|
||
[dependencies.uuid] | ||
version = "0.6" | ||
features = ["v4"] | ||
|
||
[dependencies.gm-types] | ||
path = "../gm-types" | ||
version = "0.4.0" | ||
|
||
[dev-dependencies] | ||
rpassword = "0.4.2" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
//! Error handling. | ||
macro_rules! derive_from { | ||
($err:ident, $($var:ident, $ty:ty),*) => { | ||
$( | ||
impl From<$ty> for $err { | ||
fn from(e: $ty) -> $err { | ||
$err::$var(e) | ||
} | ||
} | ||
)* | ||
} | ||
} | ||
/// Something Matrixy that can go wrong. | ||
#[derive(Fail, Debug)] | ||
pub enum MatrixError { | ||
#[fail(display = "HTTP error: {}", _0)] | ||
Hyper(#[cause] ::hyper::error::Error), | ||
#[fail(display = "Serialization error: {}", _0)] | ||
Serde(#[cause] ::serde_json::Error), | ||
#[fail(display = "Error decoding URI: {}", _0)] | ||
UriError(#[cause] ::hyper::error::UriError), | ||
#[fail(display = "I/O error: {}", _0)] | ||
Io(#[cause] ::std::io::Error), | ||
#[fail(display = "OpenSSL error: {}", _0)] | ||
Openssl(#[cause] ::hyper_openssl::openssl::error::ErrorStack), | ||
#[fail(display = "Request failed with HTTP status: {}", _0)] | ||
HttpCode(::hyper::StatusCode), | ||
#[fail(display = "Error from homeserver: {:?}", _0)] | ||
BadRequest(super::types::replies::BadRequestReply) | ||
} | ||
derive_from!(MatrixError, | ||
Hyper, ::hyper::error::Error, | ||
Serde, ::serde_json::Error, | ||
UriError, ::hyper::error::UriError, | ||
Io, ::std::io::Error, | ||
Openssl, ::hyper_openssl::openssl::error::ErrorStack | ||
); | ||
/// Bog-standard result newtype. You know the drill. | ||
pub type MatrixResult<T> = Result<T, MatrixError>; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
//! Types reexported from `hyper`. | ||
pub use hyper::Method; | ||
pub use hyper::Body; | ||
pub use hyper::header::ContentType; | ||
pub use hyper::StatusCode; | ||
pub use hyper::Client; | ||
pub use hyper_openssl::HttpsConnector; | ||
pub use hyper::client::HttpConnector; | ||
pub type MatrixHyper = Client<HttpsConnector<HttpConnector>>; |
Oops, something went wrong.