diff --git a/CHANGELOG.md b/CHANGELOG.md index 1ac76533..a43b567f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,7 +11,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Support Faktory's `MUTATE` API ([#87]) - Make `Failure` struct public ([#89]) -- `Job::failure_message` convenience method ([#89]) ### Changed diff --git a/src/proto/single/mod.rs b/src/proto/single/mod.rs index 5320df5f..94ff8d17 100644 --- a/src/proto/single/mod.rs +++ b/src/proto/single/mod.rs @@ -291,17 +291,6 @@ impl Job { pub fn failure(&self) -> Option<&Failure> { self.failure.as_ref() } - - /// Error message for this job, if any. - /// - /// A convenience method that, internally, will check if this - /// job has got a [`Failure`] and - if it does - will access - /// the failure's message (see [`Failure::message`]). - /// - /// To access the entire failure, if any, use [`Job::failure`]. - pub fn failure_message(&self) -> Option<&str> { - self.failure().as_ref().and_then(|f| f.message.as_deref()) - } } pub async fn write_command( diff --git a/tests/real/community.rs b/tests/real/community.rs index c5e8c870..358fcc1a 100644 --- a/tests/real/community.rs +++ b/tests/real/community.rs @@ -964,10 +964,9 @@ async fn test_panic_and_errors_in_handler() { // let's verify that errors messages in each job's `Failure` are as expected for job in jobs { - assert_eq!( - job.failure_message().as_ref(), - job_kind_vs_error_msg.get(job.kind()) - ); + let error_message_got = job.failure().as_ref().unwrap().message.as_ref().unwrap(); + let error_message_expected = *job_kind_vs_error_msg.get(job.kind()).unwrap(); + assert_eq!(error_message_got, error_message_expected); } } @@ -1050,7 +1049,7 @@ async fn mutation_requeue_jobs() { assert_eq!(job.id(), &job_id); // sanity check - let failure_info = job.failure().as_ref().unwrap(); + let failure_info = job.failure().unwrap(); assert_eq!(failure_info.retry_count, 0); assert_eq!( failure_info.retry_remaining, diff --git a/tests/real/utils.rs b/tests/real/utils.rs index 1ae08534..b14d24ac 100644 --- a/tests/real/utils.rs +++ b/tests/real/utils.rs @@ -1,3 +1,5 @@ +use faktory::Job; + #[macro_export] macro_rules! skip_check { () => {