Skip to content

Commit

Permalink
Partial transition to anyhow / thiserror for errors
Browse files Browse the repository at this point in the history
Signed-off-by: Heinz N. Gies <[email protected]>
  • Loading branch information
Licenser committed Nov 8, 2023
1 parent 387c36d commit 8e8a84f
Show file tree
Hide file tree
Showing 147 changed files with 2,326 additions and 2,529 deletions.
29 changes: 0 additions & 29 deletions .github/checks/deps.sh

This file was deleted.

24 changes: 4 additions & 20 deletions .github/workflows/checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,27 +24,11 @@ jobs:
unused-deps:
runs-on: ubuntu-latest
steps:
- name: Install deps
run: sudo snap install remarshal
- name: Install deps
run: sudo snap install --classic ripgrep
- uses: actions/checkout@v3
- name: Check for unused dependencies (tremor-runtime)
run: ./.github/checks/deps.sh .
- name: Check for unused dependencies (tremor-influx)
run: ./.github/checks/deps.sh tremor-influx
- name: Check for unused dependencies (tremor-pipeline)
run: ./.github/checks/deps.sh tremor-pipeline
- name: Check for unused dependencies (tremor-script)
run: ./.github/checks/deps.sh tremor-script
- name: Check for unused dependencies (tremor-cli)
run: ./.github/checks/deps.sh tremor-cli
- name: Check for unused dependencies (tremor-common)
run: ./.github/checks/deps.sh tremor-common
- name: Check for unused dependencies (tremor-value)
run: ./.github/checks/deps.sh tremor-value
- name: Check for unused dependencies (tremor-codec)
run: ./.github/checks/deps.sh tremor-codec
- name: Install deps
run: cargo install cargo-machete
- name: Check for unused dependencies
run: cargo machete

format:
runs-on: ubuntu-latest
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,5 @@ tremor-script/current_counterexample.eqc
.vscode/dryrun.log
tremor-script-nif/libpath
docs-test
*.mm_profdata
chrome_profiler.json
87 changes: 29 additions & 58 deletions Cargo.lock

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

7 changes: 1 addition & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ lto = "thin"
opt-level = 3

[dependencies]
thiserror = "1"
tokio = { version = "1.32", features = ["full"] }
tokio-stream = "0.1"
anyhow = "1"
Expand Down Expand Up @@ -64,11 +65,9 @@ jumphash = "0.1"
clickhouse-rs = { git = "https://github.com/suharev7/clickhouse-rs", rev = "73d39ba" }
dashmap = "5.5"
either = { version = "1.9", features = ["serde"] }
error-chain = "0.12"
file-mode = "0.1"
futures = "0.3.29"
event-listener = "3"
glob = "0.3"
halfbrown = "0.2"
hashbrown = { version = "0.14", features = ["serde"] }
hex = "0.4"
Expand Down Expand Up @@ -138,9 +137,6 @@ rdkafka-sys = { version = "4.6", features = [
# crononome
cron = "0.12"

# logstash grok patterns
grok = "2"

# discord
serenity = { version = "0.11", default-features = false, features = [
"client",
Expand Down Expand Up @@ -168,7 +164,6 @@ tremor-otelapis = { version = "=0.2.4" }
aws-sdk-s3 = "0.35"
aws-types = "0.57"
aws-config = "0.57"
aws-smithy-http = "0.57"

# gcp
googapis = { version = "0.6", default-features = false, features = [
Expand Down
21 changes: 20 additions & 1 deletion src/channel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,25 @@ pub(crate) type UnboundedSender<T> = tokio::sync::mpsc::UnboundedSender<T>;
pub(crate) type UnboundedReceiver<T> = tokio::sync::mpsc::UnboundedReceiver<T>;
pub(crate) type OneShotSender<T> = tokio::sync::oneshot::Sender<T>;
// pub(crate) type OneShotReceiver<T> = tokio::sync::oneshot::Receiver<T>;
pub(crate) use tokio::sync::mpsc::error::{SendError, TryRecvError};
pub(crate) use tokio::sync::mpsc::error::SendError;
pub(crate) use tokio::sync::mpsc::{channel as bounded, unbounded_channel as unbounded};
pub(crate) use tokio::sync::oneshot::channel as oneshot;

#[derive(Debug, thiserror::Error)]
pub(crate) enum ChannelError {
#[error("Could not send")]
Send,
#[error("Could not recv")]
Recv,
#[error("The channel is empty")]
Empty,
}

#[allow(clippy::needless_pass_by_value)]
pub(crate) fn send_e<T>(_: crate::channel::SendError<T>) -> anyhow::Error {
ChannelError::Send.into()
}

pub(crate) fn empty_e() -> ChannelError {
ChannelError::Empty
}
Loading

0 comments on commit 8e8a84f

Please sign in to comment.