mirror of
https://github.com/hannobraun/Fornjot
synced 2025-10-10 09:58:05 +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;)*) => {
|
||||
$(
|
||||
$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());
|
||||
});
|
||||
)*
|
||||
@ -50,7 +50,7 @@ macro_rules! validate_references {
|
||||
/// Validation errors for when an object is referenced by multiple other objects. Each object
|
||||
/// should only be referenced by a single other object
|
||||
#[derive(Clone, Debug, thiserror::Error)]
|
||||
pub enum ReferenceCountError {
|
||||
pub enum ObjectNotExclusivelyOwned {
|
||||
/// [`Region`] referenced by more than one [`Face`]
|
||||
#[error(
|
||||
"[`Region`] referenced by more than one [`Face`]\n{references:#?}"
|
||||
|
@ -9,7 +9,7 @@ use crate::{
|
||||
};
|
||||
|
||||
use super::{
|
||||
references::{ReferenceCountError, ReferenceCounter},
|
||||
references::{ObjectNotExclusivelyOwned, ReferenceCounter},
|
||||
Validate, ValidationConfig, ValidationError,
|
||||
};
|
||||
|
||||
@ -39,7 +39,7 @@ impl Validate for Sketch {
|
||||
pub enum SketchValidationError {
|
||||
/// 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
|
||||
#[error(
|
||||
@ -136,8 +136,8 @@ mod tests {
|
||||
},
|
||||
topology::{Cycle, HalfEdge, Region, Sketch, Vertex},
|
||||
validate::{
|
||||
references::ReferenceCountError, SketchValidationError, Validate,
|
||||
ValidationError,
|
||||
references::ObjectNotExclusivelyOwned, SketchValidationError,
|
||||
Validate, ValidationError,
|
||||
},
|
||||
Core,
|
||||
};
|
||||
@ -171,7 +171,7 @@ mod tests {
|
||||
core,
|
||||
invalid_sketch,
|
||||
ValidationError::Sketch(SketchValidationError::MultipleReferences(
|
||||
ReferenceCountError::Cycle { references: _ }
|
||||
ObjectNotExclusivelyOwned::Cycle { references: _ }
|
||||
))
|
||||
);
|
||||
|
||||
@ -209,7 +209,7 @@ mod tests {
|
||||
core,
|
||||
invalid_sketch,
|
||||
ValidationError::Sketch(SketchValidationError::MultipleReferences(
|
||||
ReferenceCountError::HalfEdge { references: _ }
|
||||
ObjectNotExclusivelyOwned::HalfEdge { references: _ }
|
||||
))
|
||||
);
|
||||
|
||||
|
@ -9,7 +9,7 @@ use crate::{
|
||||
use fj_math::Point;
|
||||
|
||||
use super::{
|
||||
references::{ReferenceCountError, ReferenceCounter},
|
||||
references::{ObjectNotExclusivelyOwned, ReferenceCounter},
|
||||
Validate, ValidationConfig, ValidationError,
|
||||
};
|
||||
|
||||
@ -70,7 +70,7 @@ pub enum SolidValidationError {
|
||||
|
||||
/// 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 {
|
||||
@ -187,8 +187,8 @@ mod tests {
|
||||
},
|
||||
topology::{Cycle, Face, HalfEdge, Region, Shell, Solid, Surface},
|
||||
validate::{
|
||||
references::ReferenceCountError, SolidValidationError, Validate,
|
||||
ValidationError,
|
||||
references::ObjectNotExclusivelyOwned, SolidValidationError,
|
||||
Validate, ValidationError,
|
||||
},
|
||||
Core,
|
||||
};
|
||||
@ -238,7 +238,7 @@ mod tests {
|
||||
core,
|
||||
invalid_solid,
|
||||
ValidationError::Solid(SolidValidationError::MultipleReferences(
|
||||
ReferenceCountError::Face { references: _ }
|
||||
ObjectNotExclusivelyOwned::Face { references: _ }
|
||||
))
|
||||
);
|
||||
|
||||
@ -284,7 +284,7 @@ mod tests {
|
||||
core,
|
||||
invalid_solid,
|
||||
ValidationError::Solid(SolidValidationError::MultipleReferences(
|
||||
ReferenceCountError::Region { references: _ }
|
||||
ObjectNotExclusivelyOwned::Region { references: _ }
|
||||
))
|
||||
);
|
||||
|
||||
@ -334,7 +334,7 @@ mod tests {
|
||||
core,
|
||||
invalid_solid,
|
||||
ValidationError::Solid(SolidValidationError::MultipleReferences(
|
||||
ReferenceCountError::Cycle { references: _ }
|
||||
ObjectNotExclusivelyOwned::Cycle { references: _ }
|
||||
))
|
||||
);
|
||||
|
||||
@ -376,7 +376,7 @@ mod tests {
|
||||
core,
|
||||
invalid_solid,
|
||||
ValidationError::Solid(SolidValidationError::MultipleReferences(
|
||||
ReferenceCountError::HalfEdge { references: _ }
|
||||
ObjectNotExclusivelyOwned::HalfEdge { references: _ }
|
||||
))
|
||||
);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user