From f558c835a41052b7609f0f0b27c5bbc4fe6b024d Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Tue, 7 Mar 2023 16:59:53 -0700 Subject: [PATCH] std.Build.CheckObjectStep: better error message when reading the file fails --- lib/std/Build/CheckObjectStep.zig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/std/Build/CheckObjectStep.zig b/lib/std/Build/CheckObjectStep.zig index 2a58850fab..7cac2d04ec 100644 --- a/lib/std/Build/CheckObjectStep.zig +++ b/lib/std/Build/CheckObjectStep.zig @@ -314,14 +314,14 @@ fn make(step: *Step, prog_node: *std.Progress.Node) !void { const self = @fieldParentPtr(CheckObjectStep, "step", step); const src_path = self.source.getPath(b); - const contents = try fs.cwd().readFileAllocOptions( + const contents = fs.cwd().readFileAllocOptions( gpa, src_path, self.max_bytes, null, @alignOf(u64), null, - ); + ) catch |err| return step.fail("unable to read '{s}': {s}", .{ src_path, @errorName(err) }); const output = switch (self.obj_format) { .macho => try MachODumper.parseAndDump(step, contents, .{