refactor: eliminate generic InvalidArgument errors

InvalidArgument is too generic and makes tracking the source of the
error potentially difficult.
This commit is contained in:
CJ van den Berg 2024-12-12 17:02:11 +01:00
parent 4ec66be2d4
commit a5849a7dab
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9
10 changed files with 42 additions and 42 deletions

View file

@ -111,7 +111,7 @@ const cmds = struct {
pub fn mini_mode_insert_code_point(self: *Self, ctx: Ctx) Result {
var keypress: usize = 0;
if (!try ctx.args.match(.{tp.extract(&keypress)}))
return error.InvalidArgument;
return error.InvalidGotoInsertCodePointArgument;
switch (keypress) {
'0'...'9' => self.insert_char(@intCast(keypress)),
else => {},
@ -124,7 +124,7 @@ const cmds = struct {
pub fn mini_mode_insert_bytes(self: *Self, ctx: Ctx) Result {
var bytes: []const u8 = undefined;
if (!try ctx.args.match(.{tp.extract(&bytes)}))
return error.InvalidArgument;
return error.InvalidGotoInsertBytesArgument;
self.insert_bytes(bytes);
self.update_mini_mode_text();
self.goto();