summaryrefslogtreecommitdiff
path: root/AK
diff options
context:
space:
mode:
authorTim Schumacher <timschumi@gmx.de>2023-02-10 11:40:12 +0100
committerAndreas Kling <kling@serenityos.org>2023-02-10 12:15:02 +0100
commitbe25602d44fef78ce759f455403eb0546b61817a (patch)
treea6d17d78f7621496f16c2ae7cf6f09482df55943 /AK
parentcc8874b5aa16de7f413fda53bd039579c077bc2d (diff)
downloadserenity-be25602d44fef78ce759f455403eb0546b61817a.zip
AK: Allow explicitly copying Errors in the Kernel
Diffstat (limited to 'AK')
-rw-r--r--AK/Error.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/AK/Error.h b/AK/Error.h
index bb7315d8c8..302de1cf3c 100644
--- a/AK/Error.h
+++ b/AK/Error.h
@@ -38,12 +38,14 @@ public:
return Error(syscall_name, rc);
}
[[nodiscard]] static Error from_string_view(StringView string_literal) { return Error(string_literal); }
+#endif
[[nodiscard]] static Error copy(Error const& error)
{
return Error(error);
}
+#ifndef KERNEL
// NOTE: Prefer `from_string_literal` when directly typing out an error message:
//
// return Error::from_string_literal("Class: Some failure");
@@ -108,10 +110,12 @@ private:
, m_syscall(true)
{
}
+#endif
Error(Error const&) = default;
Error& operator=(Error const&) = default;
+#ifndef KERNEL
StringView m_string_literal;
#endif