Skip to content

Commit

Permalink
Merge pull request #1914 from hannobraun/error
Browse files Browse the repository at this point in the history
Improve validation error output
  • Loading branch information
hannobraun authored Jul 3, 2023
2 parents 5fc2086 + 310423c commit ffca5cf
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
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

0 comments on commit ffca5cf

Please sign in to comment.