mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 12:14:58 +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
1 changed files with 5 additions and 1 deletions
|
@ -24,7 +24,11 @@ public:
|
||||||
ALWAYS_INLINE Error(Error&&) = default;
|
ALWAYS_INLINE Error(Error&&) = default;
|
||||||
ALWAYS_INLINE Error& operator=(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
|
// NOTE: For calling this method from within kernel code, we will simply print
|
||||||
// the error message and return the errno code.
|
// the error message and return the errno code.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue