Commit f558c835a4

Andrew Kelley <andrew@ziglang.org>
2023-03-08 00:59:53
std.Build.CheckObjectStep: better error message
when reading the file fails
1 parent 4efeeaa
Changed files (1)
lib
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, .{