mirror of
https://github.com/oven-sh/bun
synced 2026-02-16 22:01:47 +00:00
Clean up some error handling when loading tsconfig.json
This commit is contained in:
@@ -3871,9 +3871,9 @@ pub const Resolver = struct {
|
||||
) catch |err| brk: {
|
||||
const pretty = r.prettyPath(Path.init(tsconfigpath));
|
||||
|
||||
if (err == error.ENOENT) {
|
||||
if (err == error.ENOENT or err == error.FileNotFound) {
|
||||
r.log.addErrorFmt(null, logger.Loc.Empty, r.allocator, "Cannot find tsconfig file \"{s}\"", .{pretty}) catch unreachable;
|
||||
} else if (err != error.ParseErrorAlreadyLogged and err != error.IsDir) {
|
||||
} else if (err != error.ParseErrorAlreadyLogged and err != error.IsDir and err != error.EISDIR) {
|
||||
r.log.addErrorFmt(null, logger.Loc.Empty, r.allocator, "Cannot read file \"{s}\": {s}", .{ pretty, @errorName(err) }) catch unreachable;
|
||||
}
|
||||
break :brk null;
|
||||
@@ -3886,7 +3886,12 @@ pub const Resolver = struct {
|
||||
var ts_dir_name = Dirname.dirname(current.abs_path);
|
||||
// not sure why this needs cwd but we'll just pass in the dir of the tsconfig...
|
||||
var abs_path = ResolvePath.joinAbsStringBuf(ts_dir_name, bufs(.tsconfig_path_abs), &[_]string{ ts_dir_name, current.extends }, .auto);
|
||||
var parent_config_maybe = try r.parseTSConfig(abs_path, 0);
|
||||
var parent_config_maybe = r.parseTSConfig(abs_path, 0) catch |err| {
|
||||
r.log.addWarningFmt(null, logger.Loc.Empty, r.allocator, "{s} loading tsconfig.json extends {s}", .{ @errorName(err), strings.QuotedFormatter{
|
||||
.text = abs_path,
|
||||
} }) catch {};
|
||||
break;
|
||||
};
|
||||
if (parent_config_maybe) |parent_config| {
|
||||
try parent_configs.append(parent_config);
|
||||
current = parent_config;
|
||||
|
||||
Reference in New Issue
Block a user