Browse Source

Kernel: Add KResultOr::release_error()

This is just for symmetry with AK::Result, so that we can use them
interchangeably in generic code.
Andreas Kling 3 years ago
parent
commit
fd44336ef8
1 changed files with 6 additions and 0 deletions
  1. 6 0
      Kernel/API/KResult.h

+ 6 - 0
Kernel/API/KResult.h

@@ -162,6 +162,12 @@ public:
         return released_value;
         return released_value;
     }
     }
 
 
+    [[nodiscard]] KResult release_error()
+    {
+        VERIFY(m_is_error);
+        return m_error;
+    }
+
 private:
 private:
     union {
     union {
         alignas(T) char m_storage[sizeof(T)];
         alignas(T) char m_storage[sizeof(T)];