| ... | @@ -183,17 +183,17 @@ pub fn main() !void { | ... | @@ -183,17 +183,17 @@ pub fn main() !void { |
| 183 | var mapping_results = parseAndRemoveLineCommands(allocator, full_input, full_input, .{ .initial_filename = options.input_filename }) catch |err| switch (err) { | 183 | var mapping_results = parseAndRemoveLineCommands(allocator, full_input, full_input, .{ .initial_filename = options.input_filename }) catch |err| switch (err) { |
| 184 | error.InvalidLineCommand => { | 184 | error.InvalidLineCommand => { |
| 185 | // TODO: Maybe output the invalid line command | 185 | // TODO: Maybe output the invalid line command |
| 186 | try renderErrorMessage(stderr.writer(), stderr_config, .err, "invalid line command in the preprocessed source", .{}); | 186 | try error_handler.emitMessage(allocator, .err, "invalid line command in the preprocessed source", .{}); |
| 187 | if (options.preprocess == .no) { | 187 | if (options.preprocess == .no) { |
| 188 | try renderErrorMessage(stderr.writer(), stderr_config, .note, "line commands must be of the format: #line <num> \"<path>\"", .{}); | 188 | try error_handler.emitMessage(allocator, .note, "line commands must be of the format: #line <num> \"<path>\"", .{}); |
| 189 | } else { | 189 | } else { |
| 190 | try renderErrorMessage(stderr.writer(), stderr_config, .note, "this is likely to be a bug, please report it", .{}); | 190 | try error_handler.emitMessage(allocator, .note, "this is likely to be a bug, please report it", .{}); |
| 191 | } | 191 | } |
| 192 | std.process.exit(1); | 192 | std.process.exit(1); |
| 193 | }, | 193 | }, |
| 194 | error.LineNumberOverflow => { | 194 | error.LineNumberOverflow => { |
| 195 | // TODO: Better error message | 195 | // TODO: Better error message |
| 196 | try renderErrorMessage(stderr.writer(), stderr_config, .err, "line number count exceeded maximum of {}", .{std.math.maxInt(usize)}); | 196 | try error_handler.emitMessage(allocator, .err, "line number count exceeded maximum of {}", .{std.math.maxInt(usize)}); |
| 197 | std.process.exit(1); | 197 | std.process.exit(1); |
| 198 | }, | 198 | }, |
| 199 | error.OutOfMemory => |e| return e, | 199 | error.OutOfMemory => |e| return e, |