Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve validation error output #1914

Merged
merged 2 commits into from
Jul 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion crates/fj-core/src/services/validation.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::{collections::BTreeMap, thread};
use std::{collections::BTreeMap, error::Error, thread};

use crate::{
objects::{BehindHandle, Object, ObjectSet},
Expand Down Expand Up @@ -26,6 +26,14 @@ impl Drop for Validation {

for err in self.errors.values() {
println!("{}", err);

// Once `Report` is stable, we can replace this:
// https://doc.rust-lang.org/std/error/struct.Report.html
let mut source = err.source();
while let Some(err) = source {
println!("Caused by:\n\t{err}");
source = err.source();
}
}

if !thread::panicking() {
Expand Down
7 changes: 3 additions & 4 deletions crates/fj-core/src/validate/cycle.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
use crate::objects::Cycle;
use crate::objects::HalfEdge;
use fj_math::Point;
use fj_math::Scalar;
use fj_math::{Point, Scalar};
use itertools::Itertools;

use crate::objects::{Cycle, HalfEdge};

use super::{Validate, ValidationConfig, ValidationError};

impl Validate for Cycle {
Expand Down