diff options
author | Sam Atkins <atkinssj@serenityos.org> | 2023-03-17 16:10:56 +0000 |
---|---|---|
committer | Andrew Kaster <andrewdkaster@gmail.com> | 2023-05-28 05:51:27 -0600 |
commit | c140b67be328ad1e90b03c59bd61c4ce76257381 (patch) | |
tree | c7a0ee5e0c340d4aa733e36f031935e18d8f81e3 | |
parent | 6bcde0dcf44c30a532ba42730e97ced3781f9f6e (diff) | |
download | serenity-c140b67be328ad1e90b03c59bd61c4ce76257381.zip |
AK: Verify that we don't call Error::from_errno(0)
We shouldn't ever make an Error if there wasn't actually an error. :^)
-rw-r--r-- | AK/Error.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/AK/Error.h b/AK/Error.h index 1405f07a3f..33ee2d0924 100644 --- a/AK/Error.h +++ b/AK/Error.h @@ -24,7 +24,11 @@ public: ALWAYS_INLINE Error(Error&&) = default; ALWAYS_INLINE Error& operator=(Error&&) = default; - [[nodiscard]] static Error from_errno(int code) { return Error(code); } + [[nodiscard]] static Error from_errno(int code) + { + VERIFY(code != 0); + return Error(code); + } // NOTE: For calling this method from within kernel code, we will simply print // the error message and return the errno code. |