mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 07:30:19 +00:00
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. :^)
This commit is contained in:
parent
6bcde0dcf4
commit
c140b67be3
Notes:
sideshowbarker
2024-07-17 08:13:43 +09:00
Author: https://github.com/AtkinsSJ Commit: https://github.com/SerenityOS/serenity/commit/c140b67be3 Pull-request: https://github.com/SerenityOS/serenity/pull/17894 Reviewed-by: https://github.com/ADKaster ✅ Reviewed-by: https://github.com/supercomputer7
1 changed files with 5 additions and 1 deletions
|
@ -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.
|
||||
|
|
Loading…
Reference in a new issue