mirror of
https://github.com/ziglang/zig.git
synced 2025-12-07 23:03:08 +00:00
better error messages
This commit is contained in:
parent
d1ecb742ec
commit
3cc19cd865
12
src/link.zig
12
src/link.zig
@ -1383,12 +1383,12 @@ pub const File = struct {
|
|||||||
for (comp.link_inputs) |input| {
|
for (comp.link_inputs) |input| {
|
||||||
base.loadInput(input) catch |err| switch (err) {
|
base.loadInput(input) catch |err| switch (err) {
|
||||||
error.LinkFailure => return, // error reported via link_diags
|
error.LinkFailure => return, // error reported via link_diags
|
||||||
else => |e| {
|
else => |e| switch (input) {
|
||||||
if (input.path()) |path| {
|
.dso => |dso| comp.link_diags.addParseError(dso.path, "failed to parse shared library: {s}", .{@errorName(e)}),
|
||||||
comp.link_diags.addParseError(path, "failed to parse linker input: {s}", .{@errorName(e)});
|
.object => |obj| comp.link_diags.addParseError(obj.path, "failed to parse object: {s}", .{@errorName(e)}),
|
||||||
} else {
|
.archive => |obj| comp.link_diags.addParseError(obj.path, "failed to parse archive: {s}", .{@errorName(e)}),
|
||||||
comp.link_diags.addError("failed to {s}: {s}", .{ input.taskName(), @errorName(e) });
|
.res => |res| comp.link_diags.addParseError(res.path, "failed to parse Windows resource: {s}", .{@errorName(e)}),
|
||||||
}
|
.dso_exact => comp.link_diags.addError("failed to handle dso_exact: {s}", .{@errorName(e)}),
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3910,7 +3910,7 @@ fn testUnknownFileTypeError(b: *Build, opts: Options) *Step {
|
|||||||
exe.linkLibC();
|
exe.linkLibC();
|
||||||
|
|
||||||
expectLinkErrors(exe, test_step, .{
|
expectLinkErrors(exe, test_step, .{
|
||||||
.contains = "error: failed to parse shared object: BadMagic",
|
.contains = "error: failed to parse shared library: BadMagic",
|
||||||
});
|
});
|
||||||
|
|
||||||
return test_step;
|
return test_step;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user