aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <jarred@jarredsumner.com> 2021-09-02 19:25:54 -0700
committerGravatar Jarred Sumner <jarred@jarredsumner.com> 2021-09-02 19:25:54 -0700
commit2e58176ac741c18111234bdf49216daecba78bd6 (patch)
treefb78ac97b37d64c8a39a44ddd583e441486c6887
parent54a7c4290a3112226a83f8c9cccc1433dd8d282e (diff)
downloadbun-2e58176ac741c18111234bdf49216daecba78bd6.tar.gz
bun-2e58176ac741c18111234bdf49216daecba78bd6.tar.zst
bun-2e58176ac741c18111234bdf49216daecba78bd6.zip
Ensure we log the file path when reading a file fails
Former-commit-id: 90f53eafb983bccd662c0329f031cef405bc80b0
-rw-r--r--src/bundler.zig13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/bundler.zig b/src/bundler.zig
index 30876c52c..b80bc9c78 100644
--- a/src/bundler.zig
+++ b/src/bundler.zig
@@ -1942,7 +1942,10 @@ pub fn NewBundler(cache_files: bool) type {
dirname_fd,
true,
file_descriptor,
- ) catch return null;
+ ) catch |err| {
+ bundler.log.addErrorFmt(null, logger.Loc.Empty, bundler.allocator, "{s} reading \"{s}\"", .{ @errorName(err), path.text }) catch {};
+ return null;
+ };
input_fd = entry.fd;
break :brk logger.Source.initRecycledFile(Fs.File{ .path = path, .contents = entry.contents }, bundler.allocator) catch return null;
};
@@ -1977,7 +1980,13 @@ pub fn NewBundler(cache_files: bool) type {
bundler.options.jsx.supports_fast_refresh;
opts.filepath_hash_for_hmr = file_hash orelse 0;
opts.warn_about_unbundled_modules = bundler.options.platform != .bun;
- const value = (bundler.resolver.caches.js.parse(allocator, opts, bundler.options.define, bundler.log, &source) catch null) orelse return null;
+ const value = (bundler.resolver.caches.js.parse(
+ allocator,
+ opts,
+ bundler.options.define,
+ bundler.log,
+ &source,
+ ) catch null) orelse return null;
return ParseResult{
.ast = value,
.source = source,