Skip to content

Commit 404a250

Browse files
refactor: lower-case error messages (#42)
* refactor: lower-case error messages * fix: bump version and rust toolchain * fix: cargo deny * fixup! refactor: lower-case error messages
1 parent 9d14039 commit 404a250

File tree

13 files changed

+48
-46
lines changed

13 files changed

+48
-46
lines changed

Cargo.lock

Lines changed: 14 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "rebased-stardust-indexer"
3-
version = "0.5.0"
3+
version = "0.5.1"
44
edition = "2021"
55

66
[dependencies]

deny.toml

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@
1818
# dependencies not shared by any other crates, would be ignored, as the target
1919
# list here is effectively saying which targets you are building for.
2020
targets = [
21-
22-
2321
# The triple can be any string, but only the target triples built in to
2422
# rustc (as of 1.40) can be checked against actual config expressions
2523
# { triple = "x86_64-unknown-linux-musl" },
@@ -48,13 +46,27 @@ ignore = [
4846
"RUSTSEC-2024-0370",
4947
# yaml-rust is unmaintained
5048
"RUSTSEC-2024-0320",
51-
# difference is unmaintained
52-
"RUSTSEC-2020-0095",
49+
# # difference is unmaintained
50+
# "RUSTSEC-2020-0095",
5351
# derivative is unmaintained
5452
"RUSTSEC-2024-0388",
5553
# instant is unmaintained
5654
"RUSTSEC-2024-0384",
55+
# paste is unmaintained
56+
"RUSTSEC-2024-0436",
57+
# backoff is unmaintained
58+
"RUSTSEC-2025-0012",
59+
# Logging user input may result in poisoning logs with ANSI escape sequences
60+
"RUSTSEC-2025-0055",
61+
62+
# these shall be fixed once we update the iota dependencies
63+
#
64+
# tokio: Broadcast channel calls clone in parallel, but does not require `Sync`
65+
"RUSTSEC-2025-0023",
66+
# protobuf: Crash due to uncontrolled recursion in protobuf crate
67+
"RUSTSEC-2024-0437"
5768
]
69+
5870
# Threshold for security vulnerabilities, any vulnerability with a CVSS score
5971
# lower than the range specified will be ignored. Note that ignored advisories
6072
# will still output a note when they are encountered.
@@ -159,8 +171,6 @@ ignore = false
159171
# is only published to private registries, and ignore is true, the crate will
160172
# not have its license(s) checked
161173
registries = [
162-
163-
164174
# "https://sekretz.com/registry
165175
]
166176

@@ -180,14 +190,10 @@ wildcards = "allow"
180190
highlight = "all"
181191
# List of crates that are allowed. Use with care!
182192
allow = [
183-
184-
185193
# { name = "ansi_term", version = "=0.11.0" },
186194
]
187195
# List of crates to deny
188196
deny = [
189-
190-
191197
# Each entry the name of a crate and a version range. If version is
192198
# not specified, all versions will be matched.
193199
# { name = "ansi_term", version = "=0.11.0" },
@@ -198,8 +204,6 @@ deny = [
198204
]
199205
# Certain crates/versions that will be skipped when doing duplicate detection.
200206
skip = [
201-
202-
203207
# { name = "ansi_term", version = "=0.11.0" },
204208
]
205209
# Similarly to `skip` allows you to skip certain crates during duplicate
@@ -237,4 +241,4 @@ allow-git = [
237241
"https://github.com/bmwill/openapiv3.git",
238242
]
239243

240-
[sources.allow-org]
244+
[sources.allow-org]

rust-toolchain.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
[toolchain]
2-
channel = "1.85"
2+
channel = "1.88"

src/db.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,8 @@ impl ConnectionPool {
113113
Name::ProgressStore => "PROGRESS_STORE_DB_URL",
114114
};
115115

116-
let database_url =
117-
env::var(db_url_env_var).unwrap_or_else(|_| panic!("{db_url_env_var} must be set"));
116+
let database_url = env::var(db_url_env_var)
117+
.unwrap_or_else(|_| panic!("the {db_url_env_var} environment variable must be set"));
118118
Self::new_with_url(&database_url, pool_config, db_name)
119119
}
120120

src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ async fn run_indexer(
110110
// Spawn the REST server
111111
spawn_rest_server(rest_api_address, connection_pool, token)
112112
.await
113-
.inspect_err(|e| error!("REST server terminated with error: {e}"))?;
113+
.inspect_err(|e| error!("rest server terminated with error: {e}"))?;
114114

115115
Ok(())
116116
}

src/metrics.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,9 @@ pub(crate) fn spawn_prometheus_server(
7373
// Attempt to bind the socket
7474
let listener = tokio::net::TcpListener::bind(socket_addr)
7575
.await
76-
.map_err(|e| anyhow::anyhow!("Failed to bind to socket {}: {}", socket_addr, e))?;
76+
.map_err(|e| anyhow::anyhow!("failed to bind to socket {socket_addr}: {e}"))?;
7777

78-
info!("Listening on: {}", socket_addr);
78+
info!("Listening on: {socket_addr}");
7979

8080
let app = Router::new()
8181
.route(METRICS_ROUTE, get(metrics))
@@ -88,7 +88,7 @@ pub(crate) fn spawn_prometheus_server(
8888
info!("Shutdown signal received.");
8989
})
9090
.await
91-
.map_err(|e| anyhow::anyhow!("Server encountered an error: {}", e))?;
91+
.map_err(|e| anyhow::anyhow!("server encountered an error: {e}"))?;
9292

9393
Ok(())
9494
});

src/rest/extractors.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@ where
2626
match AxumPath::<T>::from_request_parts(parts, state).await {
2727
Ok(value) => Ok(Self(value.0)),
2828
Err(e) => Err(ApiError::BadRequest(format!(
29-
"invalid path parameter provided: {}",
30-
e
29+
"invalid path parameter provided: {e}"
3130
))),
3231
}
3332
}

src/rest/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ pub(crate) fn spawn_rest_server(
5858
info!("Shutdown signal received.");
5959
})
6060
.await
61-
.inspect_err(|e| error!("Server encountered an error: {e}"))
61+
.inspect_err(|e| error!("server encountered an error: {e}"))
6262
.ok();
6363
})
6464
}

src/rest/routes/health.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@ use crate::{
2828
pub(crate) async fn health(Extension(state): Extension<State>) -> Result<HealthResponse, ApiError> {
2929
let mut conn = state.connection_pool.get_connection().map_err(|e| {
3030
error!("failed to get connection: {e}");
31-
ApiError::ServiceUnavailable(format!("failed to get connection: {}", e))
31+
ApiError::ServiceUnavailable(format!("failed to get connection: {e}"))
3232
})?;
3333

3434
let objects_count = objects.count().get_result(&mut conn).map_err(|e| {
3535
error!("failed to count objects: {e}");
36-
ApiError::ServiceUnavailable(format!("failed to count objects: {}", e))
36+
ApiError::ServiceUnavailable(format!("failed to count objects: {e}"))
3737
})?;
3838

3939
let basic_objects_count = objects

0 commit comments

Comments
 (0)