From 1a4dd47d5f691f77f5a11dbb5cdd8d58b2336245 Mon Sep 17 00:00:00 2001 From: Sam Atkins Date: Sun, 6 Feb 2022 12:49:51 +0000 Subject: [PATCH] AK: VERIFY inside release_value_but_fixme_should_propagate_errors() While the code did already VERIFY that the ErrorOr holds a value, this was done by Variant, so the error message was just that `has()` is false. This is less helpful than I would like, especially if backtraces are not working and this is all you have to go on. Adding this extra VERIFY means the assertion message (`!is_error()`) is easier to understand. --- AK/Error.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/AK/Error.h b/AK/Error.h index f57bb1266b..298705ba0f 100644 --- a/AK/Error.h +++ b/AK/Error.h @@ -87,7 +87,11 @@ public: T release_value() { return move(value()); } ErrorType release_error() { return move(error()); } - T release_value_but_fixme_should_propagate_errors() { return release_value(); } + T release_value_but_fixme_should_propagate_errors() + { + VERIFY(!is_error()); + return release_value(); + } private: // 'downcast' is fishy in this context. Let's hide it by making it private.