Skip to content

Commit

Permalink
fix(Parser): Use ErrorBuilder of parseSubcommand invoked parser when
Browse files Browse the repository at this point in the history
it returns an error while parsing subcommand
  • Loading branch information
PrajwalCH committed Sep 13, 2022
1 parent a225b83 commit 4c1f7de
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/parser/Parser.zig
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,11 @@ fn parseSubCommand(
return self.err_builder.err;
};
var parser = Parser.init(self.allocator, Tokenizer.init(subcmd_argv), valid_subcmd);
const subcmd_ctx = try parser.parse();
const subcmd_ctx = parser.parse() catch |err| {
// Bubble up the error trace to the parent command that happened while parsing subcommand
self.err_builder = parser.err_builder;
return err;
};

return MatchedSubCommand.initWithArg(valid_subcmd.name, subcmd_ctx);
}
Expand Down

0 comments on commit 4c1f7de

Please sign in to comment.