Skip to content

Commit

Permalink
Merge pull request #1553 from hannobraun/validate
Browse files Browse the repository at this point in the history
Improve validation error message
  • Loading branch information
hannobraun authored Feb 1, 2023
2 parents 029111e + 03b06eb commit 075c0f0
Showing 1 changed file with 17 additions and 11 deletions.
28 changes: 17 additions & 11 deletions crates/fj-kernel/src/validate/vertex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,23 +29,28 @@ pub enum SurfaceVertexValidationError {
/// Mismatch between position and position of global form
#[error(
"`SurfaceVertex` position doesn't match position of its global form\n\
- `SurfaceVertex`: {surface_vertex:#?}\n\
- `GlobalVertex`: {global_vertex:#?}\n\
- `SurfaceVertex` position as global: {surface_position_as_global:?}\n\
- Distance between the positions: {distance}"
- Surface position: {surface_position:?}\n\
- Surface position converted to global position: \
{surface_position_as_global:?}\n\
- Global position: {global_position:?}\n\
- Distance between the positions: {distance}\n\
- `SurfaceVertex`: {surface_vertex:#?}"
)]
PositionMismatch {
/// The surface vertex
surface_vertex: SurfaceVertex,

/// The mismatched global vertex
global_vertex: GlobalVertex,
/// The position of the surface vertex
surface_position: Point<2>,

/// The surface position converted into a global position
surface_position_as_global: Point<3>,

/// The position of the global vertex
global_position: Point<3>,

/// The distance between the positions
distance: Scalar,

/// The surface vertex
surface_vertex: SurfaceVertex,
},
}

Expand All @@ -66,10 +71,11 @@ impl SurfaceVertexValidationError {
if distance > config.identical_max_distance {
errors.push(
Box::new(Self::PositionMismatch {
surface_vertex: surface_vertex.clone(),
global_vertex: surface_vertex.global_form().clone_object(),
surface_position: surface_vertex.position(),
surface_position_as_global,
global_position,
distance,
surface_vertex: surface_vertex.clone(),
})
.into(),
);
Expand Down

0 comments on commit 075c0f0

Please sign in to comment.