"magic-pickupdeck",
&common)?;
if shape.count_faces() != 2 {
- throw!(SpE::WrongNumberOfFaces);
+ throw!(SpE::WrongNumberOfFaces {
+ got: shape.count_faces(),
+ got_why: "shape".into(),
+ exp: 2,
+ exp_why: "required".into(),
+ });
}
gpc.moveable = PieceMoveable::IfWresting;
gpc.rotateable = false;
use crate::imports::*;
+use std::borrow::Cow;
use std::collections::hash_map::HashMap;
use std::collections::hash_set::HashSet;
use std::fmt::Debug;
#[error("compass angle invalid")] CompassAngleInvalid,
#[error("piece has zero faces")] ZeroFaces,
#[error("inconsistent face/edge colours")] InconsistentFacesEdgecoloursCount,
- #[error("wrong number of faces")] WrongNumberOfFaces,
#[error("specified with of edges, but no edges")] SpecifiedWidthOfNoEdges,
#[error("shape not supported")] UnsupportedShape,
#[error("negative timeout")] NegativeTimeout,
#[error("piece alias not found")] AliasNotFound,
#[error("piece alias target is multi spec")] AliasTargetMultiSpec,
#[error("piece alias loop")] AliasLoop(String),
+ #[error("wrong number of faces {got_why}={got} != {exp_why}={exp}")]
+ WrongNumberOfFaces {
+ got: RawFaceId,
+ exp: RawFaceId,
+ got_why: Cow<'static, str>,
+ exp_why: Cow<'static, str>,
+ }
}
//---------- Bundle "otter.toml" file ----------