Note for the future readers, If you are using Rocket Version 0.5.0 (Nov 17, 2023) and later then the Outcome::Failure
variant was removed in favor of using Outcome::Error
.
Writing this for someone come here due to error:
error[E0599]: no variant or associated item named `Failure` found for enum `Outcome` in the current scope
--> src/guards/auth_guard.rs:40:32
|
40 | Err(_) => Outcome::Failure((Status::Unauthorized, ())),
| ^^^^^^^ variant or associated item not found in `Outcome<_, (Status, _), Status>`
So you have to use Outcome::Error
like(example):
Err(_) => Outcome::Error((Status::Unauthorized, ()))
Supporting Document: https://github.com/rwf2/Rocket/blob/master/CHANGELOG.md?utm_source=chatgpt.com#:~:text=Outcome%3A%3AFailure%20was%20renamed%20to%20Outcome%3A%3AError.