mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 04:57:45 +00:00
AK: Allow explicitly copying Errors in the Kernel
This commit is contained in:
parent
cc8874b5aa
commit
be25602d44
1 changed files with 4 additions and 0 deletions
|
@ -38,12 +38,14 @@ public:
|
||||||
return Error(syscall_name, rc);
|
return Error(syscall_name, rc);
|
||||||
}
|
}
|
||||||
[[nodiscard]] static Error from_string_view(StringView string_literal) { return Error(string_literal); }
|
[[nodiscard]] static Error from_string_view(StringView string_literal) { return Error(string_literal); }
|
||||||
|
#endif
|
||||||
|
|
||||||
[[nodiscard]] static Error copy(Error const& error)
|
[[nodiscard]] static Error copy(Error const& error)
|
||||||
{
|
{
|
||||||
return Error(error);
|
return Error(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef KERNEL
|
||||||
// NOTE: Prefer `from_string_literal` when directly typing out an error message:
|
// NOTE: Prefer `from_string_literal` when directly typing out an error message:
|
||||||
//
|
//
|
||||||
// return Error::from_string_literal("Class: Some failure");
|
// return Error::from_string_literal("Class: Some failure");
|
||||||
|
@ -108,10 +110,12 @@ private:
|
||||||
, m_syscall(true)
|
, m_syscall(true)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
Error(Error const&) = default;
|
Error(Error const&) = default;
|
||||||
Error& operator=(Error const&) = default;
|
Error& operator=(Error const&) = default;
|
||||||
|
|
||||||
|
#ifndef KERNEL
|
||||||
StringView m_string_literal;
|
StringView m_string_literal;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue