mirror of
https://github.com/SerenityOS/serenity.git
synced 2026-11-07 04:29:30 -10:00
30 lines
622 B
C++
30 lines
622 B
C++
/*
|
|
* Copyright (c) 2023, Liav A. <[email protected]>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#include <AK/Error.h>
|
|
|
|
#ifdef KERNEL
|
|
# include <AK/Format.h>
|
|
#endif
|
|
|
|
namespace AK {
|
|
|
|
Error Error::from_string_view_or_print_error_and_return_errno(StringView string_literal, [[maybe_unused]] int code)
|
|
{
|
|
#ifdef KERNEL
|
|
dmesgln("{}", string_literal);
|
|
return Error::from_errno(code);
|
|
#else
|
|
return Error::from_string_view(string_literal);
|
|
#endif
|
|
}
|
|
|
|
// Properties that ErrorOr should have:
|
|
static_assert(IsTriviallyMoveConstructible<ErrorOr<int>>);
|
|
static_assert(IsTriviallyDestructible<ErrorOr<int>>);
|
|
|
|
}
|