summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibAudio/LoaderError.h
diff options
context:
space:
mode:
Diffstat (limited to 'Userland/Libraries/LibAudio/LoaderError.h')
-rw-r--r--Userland/Libraries/LibAudio/LoaderError.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/Userland/Libraries/LibAudio/LoaderError.h b/Userland/Libraries/LibAudio/LoaderError.h
index cc630fcdb8..583476c032 100644
--- a/Userland/Libraries/LibAudio/LoaderError.h
+++ b/Userland/Libraries/LibAudio/LoaderError.h
@@ -64,3 +64,12 @@ struct LoaderError {
};
}
+
+// Convenience TRY-like macro to convert an Error to a LoaderError
+#define LOADER_TRY(expression) \
+ ({ \
+ auto _temporary_result = (expression); \
+ if (_temporary_result.is_error()) \
+ return LoaderError(_temporary_result.release_error()); \
+ _temporary_result.release_value(); \
+ })