diff --git a/CHANGELOG.md b/CHANGELOG.md index a5da4db..45df4d3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,11 @@ # rabbitmqadmin-ng Change Log -## v2.16.0 (in development) +## v2.17.0 (in development) + +No changes yet. + + +## v2.16.0 (Oct 20, 2025) ### Enhancements @@ -14,6 +19,8 @@ rabbitmqadmin plugins list_on_node --node rabbit@hostname ``` +* Errors now include the `error` or `reason` field from the API response (if they were present there) + * `--timeout` is a new global option limits HTTP API request execution timeout. The value is in seconds and defaults to 60s: @@ -23,7 +30,7 @@ ### Upgrades -* RabbitMQ HTTP API client was upgraded to [`0.62.0`](https://github.com/michaelklishin/rabbitmq-http-api-rs/releases/tag/v0.62.0) +* RabbitMQ HTTP API client was upgraded to [`0.66.0`](https://github.com/michaelklishin/rabbitmq-http-api-rs/releases/tag/v0.66.0) ## v2.15.0 (Sep 30, 2025) diff --git a/Cargo.lock b/Cargo.lock index de27033..c61b761 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -125,16 +125,15 @@ dependencies = [ [[package]] name = "aws-lc-sys" -version = "0.32.2" +version = "0.32.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2b715a6010afb9e457ca2b7c9d2b9c344baa8baed7b38dc476034c171b32575" +checksum = "107a4e9d9cab9963e04e84bb8dee0e25f2a987f9a8bad5ed054abd439caa8f8c" dependencies = [ "bindgen", "cc", "cmake", "dunce", "fs_extra", - "libloading", ] [[package]] @@ -251,9 +250,9 @@ dependencies = [ [[package]] name = "cfg-if" -version = "1.0.3" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fd1289c04a9ea8cb22300a459a72a385d7c73d3259e2ed7dcb2af674838cfa9" +checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" [[package]] name = "cfg_aliases" @@ -623,21 +622,21 @@ dependencies = [ "cfg-if", "js-sys", "libc", - "wasi 0.11.1+wasi-snapshot-preview1", + "wasi", "wasm-bindgen", ] [[package]] name = "getrandom" -version = "0.3.3" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26145e563e54f2cadc477553f1ec5ee650b00862f0a58bcd12cbdc5f0ea2d2f4" +checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd" dependencies = [ "cfg-if", "js-sys", "libc", "r-efi", - "wasi 0.14.7+wasi-0.2.4", + "wasip2", "wasm-bindgen", ] @@ -938,9 +937,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.11.4" +version = "2.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b0f83760fb341a774ed326568e19f5a863af4a952def8c39f9ab92fd95b88e5" +checksum = "6717a8d2a5a929a1a2eb43a12812498ed141a0bcfb7e8f7844fbdbe4303bba9f" dependencies = [ "equivalent", "hashbrown", @@ -959,17 +958,6 @@ dependencies = [ "web-time", ] -[[package]] -name = "io-uring" -version = "0.7.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "046fa2d4d00aea763528b4950358d0ead425372445dc8ff86312b3c69ff7727b" -dependencies = [ - "bitflags", - "cfg-if", - "libc", -] - [[package]] name = "ipnet" version = "2.11.0" @@ -1013,7 +1001,7 @@ version = "0.1.34" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9afb3de4395d6b3e67a780b6de64b51c978ecf11cb9a462c66be7d4ca9039d33" dependencies = [ - "getrandom 0.3.3", + "getrandom 0.3.4", "libc", ] @@ -1041,12 +1029,12 @@ checksum = "2874a2af47a2325c2001a6e6fad9b16a53b802102b528163885171cf92b15976" [[package]] name = "libloading" -version = "0.8.8" +version = "0.8.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07033963ba89ebaf1584d767badaa2e8fcec21aedea6b8c0346d487d49c28667" +checksum = "d7c4b02199fee7c5d21a5ae7d8cfa79a6ef5bb2fc834d6e9058e89c825efdc55" dependencies = [ "cfg-if", - "windows-targets 0.53.5", + "windows-link 0.2.1", ] [[package]] @@ -1141,13 +1129,13 @@ dependencies = [ [[package]] name = "mio" -version = "1.0.4" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78bed444cc8a2160f01cbcf811ef18cac863ad68ae8ca62092e8db51d51c761c" +checksum = "69d83b0086dc8ecf3ce9ae2874b2d1290252e2a30720bea58a5c6639b0092873" dependencies = [ "libc", - "wasi 0.11.1+wasi-snapshot-preview1", - "windows-sys 0.59.0", + "wasi", + "windows-sys 0.61.2", ] [[package]] @@ -1221,9 +1209,9 @@ checksum = "a4895175b425cb1f87721b59f0f286c2092bd4af812243672510e1ac53e2e0ad" [[package]] name = "openssl" -version = "0.10.73" +version = "0.10.74" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8505734d46c8ab1e19a1dce3aef597ad87dcb4c37e7188231769bd6bd51cebf8" +checksum = "24ad14dd45412269e1a30f52ad8f0664f0f4f4a89ee8fe28c3b3527021ebb654" dependencies = [ "bitflags", "cfg-if", @@ -1253,9 +1241,9 @@ checksum = "d05e27ee213611ffe7d6348b942e8f942b37114c00cc03cec254295a4a17852e" [[package]] name = "openssl-sys" -version = "0.9.109" +version = "0.9.110" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90096e2e47630d78b7d1c20952dc621f957103f8bc2c8359ec81290d75238571" +checksum = "0a9f0075ba3c21b09f8e8b2026584b1d18d49388648f2fbbf3c97ea8deced8e2" dependencies = [ "cc", "libc", @@ -1467,7 +1455,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f1906b49b0c3bc04b5fe5d86a77925ae6524a19b816ae38ce1e426255f1d8a31" dependencies = [ "bytes", - "getrandom 0.3.3", + "getrandom 0.3.4", "lru-slab", "rand", "ring", @@ -1513,7 +1501,8 @@ checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" [[package]] name = "rabbitmq_http_client" version = "0.66.0" -source = "git+https://github.com/mkuratczyk/rabbitmq-http-api-rs?branch=parse-error-reason#3bff32654442012135f3406f1e0edb60a74fcab0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f429603d727775bf2761cfc7f2f75d9cfb1ad99ff059e4458f95040ce9ed7b7" dependencies = [ "backtrace", "log", @@ -1585,7 +1574,7 @@ version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" dependencies = [ - "getrandom 0.3.3", + "getrandom 0.3.4", ] [[package]] @@ -1755,9 +1744,9 @@ dependencies = [ [[package]] name = "rustls" -version = "0.23.32" +version = "0.23.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd3c25631629d034ce7cd9940adc9d45762d46de2b0f57193c4443b92c6d4d40" +checksum = "751e04a496ca00bb97a5e043158d23d66b5aabf2e1d5aa2a0aaebb1aafe6f82c" dependencies = [ "aws-lc-rs", "log", @@ -1771,9 +1760,9 @@ dependencies = [ [[package]] name = "rustls-native-certs" -version = "0.8.1" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fcff2dd52b58a8d98a70243663a0d234c4e2b79235637849d15913394a247d3" +checksum = "9980d917ebb0c0536119ba501e90834767bffc3d60641457fd84a1f3fd337923" dependencies = [ "openssl-probe", "rustls-pki-types", @@ -2102,7 +2091,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2d31c77bdf42a745371d260a26ca7163f1e0924b64afa0b688e61b5a9fa02f16" dependencies = [ "fastrand", - "getrandom 0.3.3", + "getrandom 0.3.4", "once_cell", "rustix", "windows-sys 0.61.2", @@ -2201,19 +2190,16 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.47.1" +version = "1.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89e49afdadebb872d3145a5638b59eb0691ea23e46ca484037cfab3b76b95038" +checksum = "ff360e02eab121e0bc37a2d3b4d4dc622e6eda3a8e5253d5435ecf5bd4c68408" dependencies = [ - "backtrace", "bytes", - "io-uring", "libc", "mio", "pin-project-lite", - "slab", "socket2", - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] @@ -2454,15 +2440,6 @@ version = "0.11.1+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" -[[package]] -name = "wasi" -version = "0.14.7+wasi-0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "883478de20367e224c0090af9cf5f9fa85bed63a95c1abf3afc5c083ebc06e8c" -dependencies = [ - "wasip2", -] - [[package]] name = "wasip2" version = "1.0.1+wasi-0.2.4" @@ -2667,15 +2644,6 @@ dependencies = [ "windows-targets 0.52.6", ] -[[package]] -name = "windows-sys" -version = "0.59.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" -dependencies = [ - "windows-targets 0.52.6", -] - [[package]] name = "windows-sys" version = "0.60.2" diff --git a/Cargo.toml b/Cargo.toml index e565008..09d85da 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,7 +17,7 @@ reqwest = { version = "0.12", features = [ "__rustls", "rustls-tls-native-roots", ] } -rabbitmq_http_client = { git = "https://github.com/mkuratczyk/rabbitmq-http-api-rs", branch = "parse-error-reason", features = [ +rabbitmq_http_client = { version = "0.66.0", features = [ "blocking", "tabled", ] } diff --git a/src/errors.rs b/src/errors.rs index 265cb6a..f0ec75c 100644 --- a/src/errors.rs +++ b/src/errors.rs @@ -12,12 +12,10 @@ // See the License for the specific language governing permissions and // limitations under the License. -use rabbitmq_http_client::error::{ConversionError, Error as ApiClientError}; +use rabbitmq_http_client::error::{ConversionError, Error as ApiClientError, ErrorDetails}; use rabbitmq_http_client::{blocking_api::HttpClientError, responses::HealthCheckFailureDetails}; -use reqwest::{ - StatusCode, - header::{HeaderMap, InvalidHeaderValue}, -}; +use reqwest::StatusCode; +use reqwest::header::{HeaderMap, InvalidHeaderValue}; use std::io; use url::Url; @@ -65,7 +63,7 @@ pub enum CommandRunError { status_code: StatusCode, url: Option, body: Option, - error_details: Option, + error_details: Option, headers: Option, }, #[error("{}", format_server_error(.status_code, .error_details))] @@ -73,7 +71,7 @@ pub enum CommandRunError { status_code: StatusCode, url: Option, body: Option, - error_details: Option, + error_details: Option, headers: Option, }, #[error("Health check failed")] @@ -114,36 +112,32 @@ impl From for CommandRunError { impl From for CommandRunError { fn from(value: HttpClientError) -> Self { - use ApiClientError::*; match value { - UnsupportedArgumentValue { property } => Self::UnsupportedArgumentValue { property }, - ClientErrorResponse { status_code, url, body, error_details, headers, .. } => { + ApiClientError::UnsupportedArgumentValue { property } => Self::UnsupportedArgumentValue { property }, + ApiClientError::ClientErrorResponse { status_code, url, body, error_details, headers, .. } => { Self::ClientError { status_code, url, body, error_details, headers } } - ServerErrorResponse { status_code, url, body, error_details, headers, .. } => { + ApiClientError::ServerErrorResponse { status_code, url, body, error_details, headers, .. } => { Self::ServerError { status_code, url, body, error_details, headers } } - HealthCheckFailed { path, details, status_code } => { + ApiClientError::HealthCheckFailed { path, details, status_code } => { Self::HealthCheckFailed { health_check_path: path, details, status_code } } - NotFound => Self::NotFound, - MultipleMatchingBindings => Self::ConflictingOptions { + ApiClientError::NotFound => Self::NotFound, + ApiClientError::MultipleMatchingBindings => Self::ConflictingOptions { message: "multiple bindings match, cannot determine which binding to delete without explicitly provided binding properties".to_owned() }, - InvalidHeaderValue { error } => Self::InvalidHeaderValue { error }, - RequestError { error, .. } => Self::RequestError { error }, - Other => Self::Other, - MissingProperty { argument } => Self::MissingArgumentValue { property: argument }, - IncompatibleBody { error, .. } => Self::IncompatibleBody { error }, - ParsingError { message } => Self::FailureDuringExecution { message }, + ApiClientError::InvalidHeaderValue { error } => Self::InvalidHeaderValue { error }, + ApiClientError::RequestError { error, .. } => Self::RequestError { error }, + ApiClientError::Other => Self::Other, + ApiClientError::MissingProperty { argument } => Self::MissingArgumentValue { property: argument }, + ApiClientError::IncompatibleBody { error, .. } => Self::IncompatibleBody { error }, + ApiClientError::ParsingError { message } => Self::FailureDuringExecution { message }, } } } -fn format_client_error( - status_code: &StatusCode, - error_details: &Option, -) -> String { +fn format_client_error(status_code: &StatusCode, error_details: &Option) -> String { if let Some(details) = error_details && let Some(reason) = details.reason() { @@ -155,10 +149,7 @@ fn format_client_error( ) } -fn format_server_error( - status_code: &StatusCode, - error_details: &Option, -) -> String { +fn format_server_error(status_code: &StatusCode, error_details: &Option) -> String { if let Some(details) = error_details && let Some(reason) = details.reason() { diff --git a/src/tables.rs b/src/tables.rs index e6013d0..4bb587f 100644 --- a/src/tables.rs +++ b/src/tables.rs @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. use rabbitmq_http_client::blocking_api::HttpClientError; +use rabbitmq_http_client::error::ErrorDetails; use rabbitmq_http_client::formatting::*; use rabbitmq_http_client::password_hashing::HashingError; use rabbitmq_http_client::responses::{ @@ -498,7 +499,7 @@ fn generic_failed_request_details( status_code: &StatusCode, url: &Option, body: &Option, - error_details: &Option, + error_details: &Option, ) -> Table { let status_code_s = status_code.to_string(); let url_s = url.clone().unwrap().to_string();