mirror of
https://github.com/hannobraun/Fornjot
synced 2025-10-15 12:28:30 +00:00
Make name of validation error more specific
This commit is contained in:
parent
b0ce5927ae
commit
30dffb4188
@ -40,7 +40,7 @@ macro_rules! validate_references {
|
|||||||
($errors:ident, $error_ty:ty;$($counter:ident, $err:ident;)*) => {
|
($errors:ident, $error_ty:ty;$($counter:ident, $err:ident;)*) => {
|
||||||
$(
|
$(
|
||||||
$counter.get_multiples().iter().for_each(|multiple| {
|
$counter.get_multiples().iter().for_each(|multiple| {
|
||||||
let reference_error = ReferenceCountError::$err { references: multiple.clone() };
|
let reference_error = ObjectNotExclusivelyOwned::$err { references: multiple.clone() };
|
||||||
$errors.push(Into::<$error_ty>::into(reference_error).into());
|
$errors.push(Into::<$error_ty>::into(reference_error).into());
|
||||||
});
|
});
|
||||||
)*
|
)*
|
||||||
@ -50,7 +50,7 @@ macro_rules! validate_references {
|
|||||||
/// Validation errors for when an object is referenced by multiple other objects. Each object
|
/// Validation errors for when an object is referenced by multiple other objects. Each object
|
||||||
/// should only be referenced by a single other object
|
/// should only be referenced by a single other object
|
||||||
#[derive(Clone, Debug, thiserror::Error)]
|
#[derive(Clone, Debug, thiserror::Error)]
|
||||||
pub enum ReferenceCountError {
|
pub enum ObjectNotExclusivelyOwned {
|
||||||
/// [`Region`] referenced by more than one [`Face`]
|
/// [`Region`] referenced by more than one [`Face`]
|
||||||
#[error(
|
#[error(
|
||||||
"[`Region`] referenced by more than one [`Face`]\n{references:#?}"
|
"[`Region`] referenced by more than one [`Face`]\n{references:#?}"
|
||||||
|
@ -9,7 +9,7 @@ use crate::{
|
|||||||
};
|
};
|
||||||
|
|
||||||
use super::{
|
use super::{
|
||||||
references::{ReferenceCountError, ReferenceCounter},
|
references::{ObjectNotExclusivelyOwned, ReferenceCounter},
|
||||||
Validate, ValidationConfig, ValidationError,
|
Validate, ValidationConfig, ValidationError,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -39,7 +39,7 @@ impl Validate for Sketch {
|
|||||||
pub enum SketchValidationError {
|
pub enum SketchValidationError {
|
||||||
/// Object within sketch referenced by more than one other object
|
/// Object within sketch referenced by more than one other object
|
||||||
#[error("Object within sketch referenced by more than one other Object")]
|
#[error("Object within sketch referenced by more than one other Object")]
|
||||||
MultipleReferences(#[from] ReferenceCountError),
|
MultipleReferences(#[from] ObjectNotExclusivelyOwned),
|
||||||
|
|
||||||
/// Region within sketch has exterior cycle with clockwise winding
|
/// Region within sketch has exterior cycle with clockwise winding
|
||||||
#[error(
|
#[error(
|
||||||
@ -136,8 +136,8 @@ mod tests {
|
|||||||
},
|
},
|
||||||
topology::{Cycle, HalfEdge, Region, Sketch, Vertex},
|
topology::{Cycle, HalfEdge, Region, Sketch, Vertex},
|
||||||
validate::{
|
validate::{
|
||||||
references::ReferenceCountError, SketchValidationError, Validate,
|
references::ObjectNotExclusivelyOwned, SketchValidationError,
|
||||||
ValidationError,
|
Validate, ValidationError,
|
||||||
},
|
},
|
||||||
Core,
|
Core,
|
||||||
};
|
};
|
||||||
@ -171,7 +171,7 @@ mod tests {
|
|||||||
core,
|
core,
|
||||||
invalid_sketch,
|
invalid_sketch,
|
||||||
ValidationError::Sketch(SketchValidationError::MultipleReferences(
|
ValidationError::Sketch(SketchValidationError::MultipleReferences(
|
||||||
ReferenceCountError::Cycle { references: _ }
|
ObjectNotExclusivelyOwned::Cycle { references: _ }
|
||||||
))
|
))
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -209,7 +209,7 @@ mod tests {
|
|||||||
core,
|
core,
|
||||||
invalid_sketch,
|
invalid_sketch,
|
||||||
ValidationError::Sketch(SketchValidationError::MultipleReferences(
|
ValidationError::Sketch(SketchValidationError::MultipleReferences(
|
||||||
ReferenceCountError::HalfEdge { references: _ }
|
ObjectNotExclusivelyOwned::HalfEdge { references: _ }
|
||||||
))
|
))
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ use crate::{
|
|||||||
use fj_math::Point;
|
use fj_math::Point;
|
||||||
|
|
||||||
use super::{
|
use super::{
|
||||||
references::{ReferenceCountError, ReferenceCounter},
|
references::{ObjectNotExclusivelyOwned, ReferenceCounter},
|
||||||
Validate, ValidationConfig, ValidationError,
|
Validate, ValidationConfig, ValidationError,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -70,7 +70,7 @@ pub enum SolidValidationError {
|
|||||||
|
|
||||||
/// Object within solid referenced by more than one other object
|
/// Object within solid referenced by more than one other object
|
||||||
#[error("Object within solid referenced by more than one other Object")]
|
#[error("Object within solid referenced by more than one other Object")]
|
||||||
MultipleReferences(#[from] ReferenceCountError),
|
MultipleReferences(#[from] ObjectNotExclusivelyOwned),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl SolidValidationError {
|
impl SolidValidationError {
|
||||||
@ -187,8 +187,8 @@ mod tests {
|
|||||||
},
|
},
|
||||||
topology::{Cycle, Face, HalfEdge, Region, Shell, Solid, Surface},
|
topology::{Cycle, Face, HalfEdge, Region, Shell, Solid, Surface},
|
||||||
validate::{
|
validate::{
|
||||||
references::ReferenceCountError, SolidValidationError, Validate,
|
references::ObjectNotExclusivelyOwned, SolidValidationError,
|
||||||
ValidationError,
|
Validate, ValidationError,
|
||||||
},
|
},
|
||||||
Core,
|
Core,
|
||||||
};
|
};
|
||||||
@ -238,7 +238,7 @@ mod tests {
|
|||||||
core,
|
core,
|
||||||
invalid_solid,
|
invalid_solid,
|
||||||
ValidationError::Solid(SolidValidationError::MultipleReferences(
|
ValidationError::Solid(SolidValidationError::MultipleReferences(
|
||||||
ReferenceCountError::Face { references: _ }
|
ObjectNotExclusivelyOwned::Face { references: _ }
|
||||||
))
|
))
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -284,7 +284,7 @@ mod tests {
|
|||||||
core,
|
core,
|
||||||
invalid_solid,
|
invalid_solid,
|
||||||
ValidationError::Solid(SolidValidationError::MultipleReferences(
|
ValidationError::Solid(SolidValidationError::MultipleReferences(
|
||||||
ReferenceCountError::Region { references: _ }
|
ObjectNotExclusivelyOwned::Region { references: _ }
|
||||||
))
|
))
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -334,7 +334,7 @@ mod tests {
|
|||||||
core,
|
core,
|
||||||
invalid_solid,
|
invalid_solid,
|
||||||
ValidationError::Solid(SolidValidationError::MultipleReferences(
|
ValidationError::Solid(SolidValidationError::MultipleReferences(
|
||||||
ReferenceCountError::Cycle { references: _ }
|
ObjectNotExclusivelyOwned::Cycle { references: _ }
|
||||||
))
|
))
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -376,7 +376,7 @@ mod tests {
|
|||||||
core,
|
core,
|
||||||
invalid_solid,
|
invalid_solid,
|
||||||
ValidationError::Solid(SolidValidationError::MultipleReferences(
|
ValidationError::Solid(SolidValidationError::MultipleReferences(
|
||||||
ReferenceCountError::HalfEdge { references: _ }
|
ObjectNotExclusivelyOwned::HalfEdge { references: _ }
|
||||||
))
|
))
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user