mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 05:07:34 +00:00
KeyboardMapper: Propagate errors using ErrorOr and TRY
KeyboardMapperWidget's load_map_from_file, load_map_from_system, save, and save_to_file now all return ErrorOr<void> and no longer handles alerting the user to potential errors. main is now responsible for handling errors originating from its calls to these four functions; it will simply alert the user using the new method KeyboardMapperWidget::show_error_to_user(Error), which simply creates a MassageBox displaying the error's string_literal. This makes the whole program slight more clean feeling :^).
This commit is contained in:
parent
4e65c4dae4
commit
9678ff15a8
3 changed files with 41 additions and 53 deletions
|
@ -17,10 +17,11 @@ public:
|
|||
virtual ~KeyboardMapperWidget() override;
|
||||
|
||||
void create_frame();
|
||||
void load_from_file(const String);
|
||||
void load_from_system();
|
||||
void save();
|
||||
void save_to_file(StringView);
|
||||
ErrorOr<void> load_map_from_file(const String&);
|
||||
ErrorOr<void> load_map_from_system();
|
||||
ErrorOr<void> save();
|
||||
ErrorOr<void> save_to_file(StringView);
|
||||
void show_error_to_user(Error);
|
||||
|
||||
protected:
|
||||
virtual void keydown_event(GUI::KeyEvent&) override;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue