mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 04:09:13 +00:00
LibKeyboard: Change some Optional<T> returns to ErrorOr<T>
Makes CharacterMapFile::load_from_file and CharacterMap::load_from_file return ErrorOr instead of Optional. This makes them a little nicer to use and a little easier to read, as they seem to have been approximating this.
This commit is contained in:
parent
017135b44e
commit
4e65c4dae4
Notes:
sideshowbarker
2024-07-17 21:33:08 +09:00
Author: https://github.com/RasmusNylander
Commit: 4e65c4dae4
Pull-request: https://github.com/SerenityOS/serenity/pull/11443
Reviewed-by: https://github.com/awesomekling
5 changed files with 10 additions and 22 deletions
|
@ -17,13 +17,11 @@ namespace Keyboard {
|
|||
#ifndef KERNEL
|
||||
// The Kernel explicitly and exclusively links only this file into it.
|
||||
// Thus, we cannot even include a reference to the symbol `CharacterMapFile::load_from_file`.
|
||||
Optional<CharacterMap> CharacterMap::load_from_file(const String& map_name)
|
||||
ErrorOr<CharacterMap> CharacterMap::load_from_file(const String& map_name)
|
||||
{
|
||||
auto result = CharacterMapFile::load_from_file(map_name);
|
||||
if (!result.has_value())
|
||||
return {};
|
||||
auto result = TRY(CharacterMapFile::load_from_file(map_name));
|
||||
|
||||
return CharacterMap(map_name, result.value());
|
||||
return CharacterMap(map_name, result);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue