stage2: print package path on --pkg-begin failure

This makes it much easier for the user to figure out what has gone wrong
than dumping an error return trace.
This commit is contained in:
Isaac Freund 2020-12-17 20:03:15 +01:00
parent c102eb83e6
commit fa09c3a5e7
No known key found for this signature in database
GPG Key ID: 86DED400DDFD7A11

View File

@ -622,11 +622,13 @@ fn buildOutputType(
i += 1;
const pkg_path = args[i];
const new_cur_pkg = try Package.create(
const new_cur_pkg = Package.create(
gpa,
fs.path.dirname(pkg_path),
fs.path.basename(pkg_path),
);
) catch |err| {
fatal("Failed to add package at path {}: {}", .{ pkg_path, @errorName(err) });
};
new_cur_pkg.parent = cur_pkg;
try cur_pkg.add(gpa, pkg_name, new_cur_pkg);
cur_pkg = new_cur_pkg;