mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-08-17 01:10:28 +03:00
AK: Make Error and ErrorOr<T> work in Lagom as well :^)
ErrnoCode is not a thing outside __serenity__, so let's not make assumptions about it existing.
This commit is contained in:
parent
6e255b262f
commit
202950bb01
Notes:
sideshowbarker
2024-07-18 01:24:18 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/202950bb01e
@ -56,10 +56,12 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
ErrorOr(ErrnoCode errno)
|
||||
: m_error(Error::from_errno(errno))
|
||||
#ifdef __serenity__
|
||||
ErrorOr(ErrnoCode code)
|
||||
: m_error(Error::from_errno(code))
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
ErrorOr(Error&& error)
|
||||
: m_error(move(error))
|
||||
|
@ -353,7 +353,7 @@ inline ErrorOr<NonnullRefPtr<T>> adopt_nonnull_ref_or_enomem(T* object)
|
||||
{
|
||||
auto result = adopt_ref_if_nonnull(object);
|
||||
if (!result)
|
||||
return ENOMEM;
|
||||
return Error::from_errno(ENOMEM);
|
||||
return result.release_nonnull();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user