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

Migrate from failure to anyhow #31

Merged
merged 1 commit into from
Jun 20, 2023
Merged
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
30 changes: 7 additions & 23 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ edition = "2021"
license = "GPL-3.0-or-later"

[dependencies]
failure = "0.1.8"
anyhow = "1.0"
clap = { version = "4.0.14", features = ["derive"] }
tokio = { version = "1.15", features = ["full"] }
tokio-util = { version = "0.7.4", features = ["codec"] }
Expand Down
3 changes: 2 additions & 1 deletion src/capture/audio/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use bytes::Bytes;
use cpal::traits::{DeviceTrait, HostTrait, StreamTrait};
use cpal::{SampleFormat, Stream};

use anyhow::anyhow;
use std::sync::mpsc::Sender;
use std::sync::Arc;
use tokio::sync::Mutex;
Expand Down Expand Up @@ -127,7 +128,7 @@ impl AudioCapture {
None,
)?,
_ => {
return Err(failure::err_msg("unsupported sample format"));
return Err(anyhow!("unsupported sample format"));
}
};

Expand Down
2 changes: 1 addition & 1 deletion src/capture/macos/display.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::capture::DisplayInfo;
use crate::result::Result;
use failure::format_err;
use anyhow::format_err;

use super::ffi::*;

Expand Down
4 changes: 2 additions & 2 deletions src/capture/macos/macos_capture.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use std::sync::Arc;
use std::time::Duration;
use std::{ptr, slice};
use std::sync::Arc;

use anyhow::format_err;
use async_trait::async_trait;
use block::{Block, ConcreteBlock};
use failure::format_err;
use libc::c_void;
use tokio::sync::mpsc::Receiver;
use tokio::sync::mpsc::Sender;
Expand Down
2 changes: 1 addition & 1 deletion src/inputs/parse_key.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::Result;
use failure::format_err;
use anyhow::format_err;

pub trait FromJsKey {
/// convert from KeyboardEvent.code
Expand Down
2 changes: 1 addition & 1 deletion src/result.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
use failure::Error;
use anyhow::Error;

pub type Result<T> = std::result::Result<T, Error>;