You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Previously we used $CWD, which is not reliably the user’s app directory. This also updates the error box text to instruct the user to reference the terminal output.
Test Plan: Added a panic in Turbo and verified stderr and error box.
let size = std::fs::metadata(LOG_FILE_PATH).map(|m| m.len());
113
+
let size = std::fs::metadata(PANIC_LOG.as_path()).map(|m| m.len());
108
114
ifletOk(size) = size {
109
115
if size > 512*1024{
110
116
// Truncate the earliest error from log file if it's larger than 512KB
111
117
let new_lines = {
112
118
let log_read = OpenOptions::new()
113
119
.read(true)
114
-
.open(LOG_FILE_PATH)
115
-
.unwrap_or_else(|_| panic!("Failed to open {}",LOG_FILE_PATH));
120
+
.open(PANIC_LOG.as_path())
121
+
.unwrap_or_else(|_| {
122
+
panic!("Failed to open {}",PANIC_LOG.to_string_lossy())
123
+
});
116
124
117
125
io::BufReader::new(&log_read)
118
126
.lines()
@@ -128,8 +136,10 @@ fn init() {
128
136
.create(true)
129
137
.truncate(true)
130
138
.write(true)
131
-
.open(LOG_FILE_PATH)
132
-
.unwrap_or_else(|_| panic!("Failed to open {}",LOG_FILE_PATH));
139
+
.open(PANIC_LOG.as_path())
140
+
.unwrap_or_else(|_| {
141
+
panic!("Failed to open {}",PANIC_LOG.to_string_lossy())
142
+
});
133
143
134
144
for line in new_lines {
135
145
match line {
@@ -147,11 +157,11 @@ fn init() {
147
157
letmut log_file = OpenOptions::new()
148
158
.create(true)
149
159
.append(true)
150
-
.open(LOG_FILE_PATH)
151
-
.unwrap_or_else(|_| panic!("Failed to open {}",LOG_FILE_PATH));
160
+
.open(PANIC_LOG.as_path())
161
+
.unwrap_or_else(|_| panic!("Failed to open {}",PANIC_LOG.to_string_lossy()));
152
162
153
163
writeln!(log_file,"{}", info).unwrap();
154
-
eprintln!("{}: An unexpected Turbopack error occurred. Please report the content of {} to https://github.com/vercel/next.js/issues/new","FATAL".red().bold(),LOG_FILE_PATH);
164
+
eprintln!("{}: An unexpected Turbopack error occurred. Please report the content of {} to https://github.com/vercel/next.js/issues/new","FATAL".red().bold(),PANIC_LOG.to_string_lossy());
// If this is an internal Turbopack error we shouldn't show internal details
30
30
// to the user. These are written to a log file instead.
31
31
constturbopackInternalError=newError(
32
-
'An unexpected Turbopack error occurred. Please report the content of .next/turbopack.log to the Next.js team at https://github.com/vercel/next.js/issues/new'
32
+
'An unexpected Turbopack error occurred. Please see the output of `next dev` for more details.'
0 commit comments