Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: box all errors, implement send sync #20

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion gpapi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ bytes = "1"
googleplay-protobuf = "2"
bincode = "1"
futures = "0.3"
tokio-dl-stream-to-disk = "1"
tokio-dl-stream-to-disk = { git = "https://github.com/xhyrom-forks/tokio-dl-stream-to-disk" }
serde = { version = "1", features = ["derive"] }

[build-dependencies]
Expand Down
20 changes: 14 additions & 6 deletions gpapi/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pub enum ErrorKind {
LoginRequired,
IO(IOError),
Str(String),
Other(Box<dyn StdError>),
Other(Box<dyn StdError + Send + Sync>),
}

#[derive(Debug)]
Expand All @@ -44,8 +44,8 @@ impl From<IOError> for Error {
}
}

impl From<Box<dyn StdError>> for Error {
fn from(err: Box<dyn StdError>) -> Error {
impl From<Box<dyn StdError + Send + Sync>> for Error {
fn from(err: Box<dyn StdError + Send + Sync>) -> Error {
Error {
kind: ErrorKind::Other(err),
}
Expand Down Expand Up @@ -107,9 +107,17 @@ impl fmt::Display for Error {
ErrorKind::FileExists => write!(f, "File already exists"),
ErrorKind::InvalidApp => write!(f, "Invalid app response"),
ErrorKind::DirectoryExists => write!(f, "Directory already exists"),
ErrorKind::DirectoryMissing => write!(f, "Destination path provided is not a valid directory"),
ErrorKind::Authentication => write!(f, "Could not authenticate with Google. Please provide a new oAuth token."),
ErrorKind::TermsOfService => write!(f, "Must accept Google Play Terms of Service before proceeding."),
ErrorKind::DirectoryMissing => {
write!(f, "Destination path provided is not a valid directory")
}
ErrorKind::Authentication => write!(
f,
"Could not authenticate with Google. Please provide a new oAuth token."
),
ErrorKind::TermsOfService => write!(
f,
"Must accept Google Play Terms of Service before proceeding."
),
ErrorKind::PermissionDenied => write!(f, "Cannot create file: permission denied"),
ErrorKind::InvalidResponse => write!(f, "Invalid response from the remote host"),
ErrorKind::LoginRequired => write!(f, "Logging in is required for this action"),
Expand Down
Loading