Skip to content

Commit

Permalink
Fix error handling in rp2xxx pio assembler (#346)
Browse files Browse the repository at this point in the history
  • Loading branch information
Grazfather authored Jan 9, 2025
1 parent af5f3d8 commit ff006c5
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions port/raspberrypi/rp2xxx/src/hal/pio/assembler.zig
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,11 @@ fn format_compile_error(comptime message: []const u8, comptime source: []const u

pub fn assemble(comptime source: []const u8, comptime options: AssembleOptions) Output {
var diags: ?Diagnostics = null;
return assemble_impl(source, &diags, options) catch |err| if (diags) |d|
@compileError(format_compile_error(d.message.slice(), source, d.index))
else
@compileError(err);
return assemble_impl(source, &diags, options) catch |err| {
if (diags) |d|
@compileError(format_compile_error(d.message.slice(), source, d.index));
@compileError(@errorName(err));
};
}

test "tokenizer and encoder" {
Expand Down

0 comments on commit ff006c5

Please sign in to comment.