1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 14:57:35 +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:
RasmusNylander 2021-12-16 17:46:49 +01:00 committed by Andreas Kling
parent 017135b44e
commit 4e65c4dae4
5 changed files with 10 additions and 22 deletions

View file

@ -34,7 +34,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
}
auto character_map = Keyboard::CharacterMap::load_from_file(path);
if (!character_map.has_value()) {
if (character_map.is_error()) {
warnln("Cannot read keymap {}", path);
warnln("Hint: Must be either a keymap name (e.g. 'en-us') or a full path.");
return 1;