Skip to content
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
9 changes: 5 additions & 4 deletions Cargo.lock

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

10 changes: 7 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ license = "AGPL-3.0-or-later"
version = "2.10.0"
edition = "2021"

[dependencies]
[features]
query-tracing = ["sqd-query/max_level_trace"]

[dependencies]
anyhow = "1.0"
async-compression = { version = "0.4.27", features = ["gzip", "tokio"] }
async-stream = "0.3.5"
Expand Down Expand Up @@ -62,8 +65,9 @@ sqd-contract-client = { git = "https://github.com/subsquid/sqd-network.git", rev
sqd-messages = { git = "https://github.com/subsquid/sqd-network.git", rev = "7ac249a", version = "2.0.2", features = ["bitstring"] }
sqd-network-transport = { git = "https://github.com/subsquid/sqd-network.git", rev = "7ac249a", version = "3.0.0", features = ["worker", "metrics"] }

sqd-query = { git = "https://github.com/subsquid/data.git", rev = "b10a969", features = ["parquet"] }
sqd-polars = { git = "https://github.com/subsquid/data.git", rev = "b10a969" }
sqd-query = { git = "https://github.com/subsquid/data.git", rev = "ad62dc2", features = ["parquet"] }
sqd-polars = { git = "https://github.com/subsquid/data.git", rev = "ad62dc2" }

sql_query_plan = {git = "https://github.com/subsquid/qplan.git", rev = "658f88f" }

[profile.release]
Expand Down
3 changes: 2 additions & 1 deletion src/controller/p2p.rs
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,8 @@ impl<EventStream: Stream<Item = WorkerEvent> + Send + 'static> P2PController<Eve
Some(peer_id),
query_type,
)
.await;
.await
.inspect_err(|err| tracing::error!("error processing query: {err}"));

if let Err(QueryError::ServiceOverloaded) = result {
self.allocations_checker.refund(peer_id);
Expand Down
11 changes: 9 additions & 2 deletions src/query/result.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use std::time::Duration;

use axum::{http::StatusCode, response::IntoResponse};
use sqd_query::{ColumnDoesNotExist, TableDoesNotExist};
use tracing::instrument;

use crate::util::hash::sha3_256;
Expand Down Expand Up @@ -97,8 +98,14 @@ impl From<std::io::Error> for QueryError {
}

impl From<anyhow::Error> for QueryError {
fn from(value: anyhow::Error) -> Self {
Self::Other(value.to_string())
fn from(err: anyhow::Error) -> Self {
let is_bad_request = err.is::<TableDoesNotExist>() || err.is::<ColumnDoesNotExist>();

if is_bad_request {
QueryError::BadRequest(err.to_string())
} else {
Self::Other(err.to_string())
}
}
}

Expand Down
Loading