Skip to content

Commit

Permalink
Fix error handling in rp2xxx pio assembler
Browse files Browse the repository at this point in the history
  • Loading branch information
Grazfather committed Jan 6, 2025
1 parent ac53836 commit 4852d4b
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 @@ -124,10 +124,11 @@ fn format_compile_error(comptime message: []const u8, comptime source: []const u

pub fn assemble(comptime cpu: CPU, comptime source: []const u8, comptime options: AssembleOptions) Output {
var diags: ?Diagnostics = null;
return assemble_impl(cpu, source, &diags, options) catch |err| if (diags) |d|
@compileError(format_compile_error(d.message.slice(), source, d.index))
else
@compileError(err);
return assemble_impl(cpu, 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 4852d4b

Please sign in to comment.