refactor: rework error handling to simplifiy command implementation and provide better back traces
This commit is contained in:
parent
21b604f4d6
commit
032982c1e8
26 changed files with 821 additions and 785 deletions
|
@ -189,24 +189,25 @@ const Commands = command.Collection(cmds);
|
|||
const cmds = struct {
|
||||
pub const Target = Self;
|
||||
const Ctx = command.Context;
|
||||
const Result = command.Result;
|
||||
|
||||
pub fn home_menu_down(self: *Self, _: Ctx) tp.result {
|
||||
pub fn home_menu_down(self: *Self, _: Ctx) Result {
|
||||
self.menu.select_down();
|
||||
}
|
||||
|
||||
pub fn home_menu_up(self: *Self, _: Ctx) tp.result {
|
||||
pub fn home_menu_up(self: *Self, _: Ctx) Result {
|
||||
self.menu.select_up();
|
||||
}
|
||||
|
||||
pub fn home_menu_activate(self: *Self, _: Ctx) tp.result {
|
||||
pub fn home_menu_activate(self: *Self, _: Ctx) Result {
|
||||
self.menu.activate_selected();
|
||||
}
|
||||
|
||||
pub fn home_sheeran(self: *Self, _: Ctx) tp.result {
|
||||
pub fn home_sheeran(self: *Self, _: Ctx) Result {
|
||||
self.fire = if (self.fire) |*fire| ret: {
|
||||
fire.deinit();
|
||||
break :ret null;
|
||||
} else Fire.init(self.a, self.plane) catch |e| return tp.exit_error(e);
|
||||
} else try Fire.init(self.a, self.plane);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue