Skip to content

Commit c588b25

Browse files
committed
Update top-level to use new presentation code
1 parent d8efa47 commit c588b25

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

src/main.rs

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ use technique::formatting::*;
1111
use technique::formatting::{self};
1212
use technique::parsing;
1313

14+
mod problem;
1415
mod rendering;
1516

1617
#[derive(Eq, Debug, PartialEq)]
@@ -144,14 +145,17 @@ fn main() {
144145
let content = match parsing::load(&filename) {
145146
Ok(data) => data,
146147
Err(error) => {
147-
eprintln!("{}", error.concise_details());
148+
eprintln!("{}", problem::concise_loading_error(&error));
148149
std::process::exit(1);
149150
}
150151
};
151152
let technique = match parsing::parse(&filename, &content) {
152153
Ok(document) => document,
153154
Err(error) => {
154-
eprintln!("{}", error.full_details());
155+
eprintln!(
156+
"{}",
157+
problem::full_parsing_error(&error, &filename, &content, &Terminal)
158+
);
155159
std::process::exit(1);
156160
}
157161
};
@@ -186,14 +190,17 @@ fn main() {
186190
let content = match parsing::load(&filename) {
187191
Ok(data) => data,
188192
Err(error) => {
189-
eprintln!("{}", error.concise_details());
193+
eprintln!("{}", problem::concise_loading_error(&error));
190194
std::process::exit(1);
191195
}
192196
};
193197
let technique = match parsing::parse(&filename, &content) {
194198
Ok(document) => document,
195199
Err(error) => {
196-
eprintln!("{}", error.concise_error());
200+
eprintln!(
201+
"{}",
202+
problem::concise_parsing_error(&error, &filename, &content, &Terminal)
203+
);
197204
std::process::exit(1);
198205
}
199206
};
@@ -218,7 +225,7 @@ fn main() {
218225
let content = match parsing::load(&filename) {
219226
Ok(data) => data,
220227
Err(error) => {
221-
eprintln!("{}", error.concise_details());
228+
eprintln!("{}", problem::concise_loading_error(&error));
222229
std::process::exit(1);
223230
}
224231
};
@@ -228,7 +235,10 @@ fn main() {
228235
// It is possible that we will want to render the error
229236
// into the PDF document rather than crashing here. We'll
230237
// see in the future.
231-
eprintln!("{}", error.full_details());
238+
eprintln!(
239+
"{}",
240+
problem::full_parsing_error(&error, &filename, &content, &Terminal)
241+
);
232242
std::process::exit(1);
233243
}
234244
};

0 commit comments

Comments
 (0)