mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 03:47:34 +00:00
LibAudio: Add LOADER_TRY to auto-convert Error to LoaderError
This commit is contained in:
parent
9702f2010f
commit
4f48a086b7
1 changed files with 9 additions and 0 deletions
|
@ -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(); \
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue