fn writeMsg(eb: ErrorBundle, err_msg: ErrorMessage, w: *Writer, indent: usize) !void eb: ErrorBundleerr_msg: ErrorMessagew: *Writerindent: usize328
329
330
331
332
333
334
335
336fn writeMsg(eb: ErrorBundle, err_msg: ErrorMessage, w: *Writer, indent: usize) !void {
var lines = std.mem.splitScalar(u8, eb.nullTerminatedString(err_msg.msg), '\n');
while (lines.next()) |line| {
try w.writeAll(line);
if (lines.index == null) break;
try w.writeByte('\n');
try w.splatByteAll(' ', indent);
}
}
Splits the error message up into lines to properly indent them to allow for long, good-looking error messages.
This is used to split the message in
@compileError("hello\nworld")for example.