mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-21 20:15:17 +00:00
AK: Allow explicitly copying Errors in the Kernel
This commit is contained in:
parent
cc8874b5aa
commit
be25602d44
Notes:
sideshowbarker
2024-07-17 05:13:53 +09:00
Author: https://github.com/timschumi Commit: https://github.com/SerenityOS/serenity/commit/be25602d44 Pull-request: https://github.com/SerenityOS/serenity/pull/17408
1 changed files with 4 additions and 0 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue