use std::os::unix::net::UnixListener;
use uds::UnixStreamExt;
-type SE = SpecError;
type CSE = anyhow::Error;
type TP = TablePermission;
let gs = &mut ig.gs;
let implicit: u32 = info.count()
.try_into().map_err(
- |_| SE::InternalError(format!("implicit item count out of range"))
+ |_| SpE::InternalError(format!("implicit item count out of range"))
)?;
let count: Box<dyn ExactSizeIterator<Item=u32>> = match count {
Some(explicit) if implicit == 1 => {
use crate::imports::*;
-type SE = SVGProcessingError;
-
// ---------- newtypes and type aliases ----------
visible_slotmap_key!{ PlayerId(b'#') }
fn make_defs(&self, pri: &PieceRenderInstructions) -> Html {
let mut defs = Html(String::new());
let dragraise = match self.thresh_dragraise(pri)? {
- Some(n) if n < 0 => throw!(SE::NegativeDragraise),
+ Some(n) if n < 0 => throw!(SvgE::NegativeDragraise),
Some(n) => n,
None => -1,
};
pub type IE = InternalError;
pub type OE = OnlineError;
pub type POEPP = PieceOpErrorPartiallyProcessed;
+pub type SvgE = SVGProcessingError;
+pub type SpE = SpecError;
// updates.rs
pub type PUE = PreparedUpdateEntry;
type ColourMap = IndexVec<FaceId, Colour>;
-type SE = SVGProcessingError;
-
#[derive(Debug,Serialize,Deserialize)]
// todo: this serialisation is rather large
pub struct SimpleShape {
fn from(se: SVGProcessingError) -> MgmtError { se.into() }
}
-#[throws(SE)]
+#[throws(SvgE)]
pub fn svg_rescale_path(input: &Html, scale: f64) -> Html {
type BM = u64;
type BI = u32;
continue;
}
}
- _ => throw!(SE::UnknownOperator),
+ _ => throw!(SvgE::UnknownOperator),
};
write!(&mut out, "{}", w)?;
}
Html(out)
}
-#[throws(SE)]
+#[throws(SvgE)]
pub fn svg_circle_path(diam: f64) -> Html {
let unit_path = Html::lit(
"M 0 1 a 1 1 0 1 0 0 -2 \
path
}
-#[throws(SE)]
+#[throws(SvgE)]
pub fn svg_rectangle_path(PosC([x,y]): PosC<f64>) -> Html {
Html(format!("M {} {} h {} v {} h {} z",
-x*0.5, -y*0.5, x, y, -x))
const INHERIT_DEPTH_LIMIT: u8 = 20;
type TV = toml::Value;
-type SE = SpecError;
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ItemSpec {
libs.as_ref()?.get(libname)?
}))()
})
- .map_err(|_| SE::LibraryNotFound)
+ .map_err(|_| SpE::LibraryNotFound)
?
}
pub fn load(&self) -> Box<dyn Piece> {
let lib = libs_lookup(&self.lib)?;
let idata = lib.items.get(&self.item)
- .ok_or(SE::LibraryItemNotFound(self.item.clone()))?;
+ .ok_or(SpE::LibraryItemNotFound(self.item.clone()))?;
lib.load1(idata, &self.item)?
}
}
.map_err(|e| if e.kind() == ErrorKind::NotFound {
warn!("library item lib={} itme={} data file {:?} not found",
&self.libname, &name, &svg_path);
- SE::LibraryItemNotFound(name.to_owned())
+ SpE::LibraryItemNotFound(name.to_owned())
} else {
let m = "error accessing/reading library item data file";
error!("{}: {}: {}", &m, &svg_path, &e);
- SE::InternalError(m.to_string())
+ SpE::InternalError(m.to_string())
})?;
idata.group.d.outline.check(&idata.group)
- .map_err(|e| SE::InternalError(format!("rechecking outline: {}",&e)))?;
+ .map_err(|e| SpE::InternalError(format!("rechecking outline: {}",&e)))?;
let outline = idata.group.d.outline.load(&idata.group)?;
let mut svgs = IndexVec::with_capacity(1);
fn count(&self) -> usize { self.items.len() }
fn load(&self, i: usize) -> Result<Box<dyn Piece>,SpecError> {
let item = self.items.get(i).ok_or_else(
- || SE::InternalError(format!("item {:?} from {:?}", i, &self))
+ || SpE::InternalError(format!("item {:?} from {:?}", i, &self))
)?;
let item = format!("{}{}{}", &self.prefix, item, &self.suffix);
let lib = self.lib.clone();
use crate::imports::*;
type AS = AccountScope;
- type SE = SpecError;
type TPS = TablePlayerSpec;
impl<T> AreaC<T> {
#[throws(SpecError)]
fn try_from(v: u8) -> Self {
if v < 8 { Self(v) }
- else { throw!(SE::CompassAngleInvalid) }
+ else { throw!(SpE::CompassAngleInvalid) }
}
}
fn try_from(ents: RawAcl<P>) -> Self {
for ent in &ents {
glob::Pattern::new(&ent.account_glob)
- .map_err(|_| SE::AclInvalidAccountGlob)?;
+ .map_err(|_| SpE::AclInvalidAccountGlob)?;
if ! ent.deny.is_disjoint(&ent.allow) {
- throw!(SE::AclEntryOverlappingAllowDeny);
+ throw!(SpE::AclEntryOverlappingAllowDeny);
}
}
Acl { ents }
#[throws(SpecError)]
fn try_from(spec: &UrlSpec) -> Url {
if spec.0.len() > UrlSpec::MAX_LEN {
- throw!(SE::UrlTooLong);
+ throw!(SpE::UrlTooLong);
}
let base = Url::parse(&config().public_url)
.or_else(|_| Url::parse(
let url = Url::options()
.base_url(Some(&base))
.parse(&spec.0)
- .map_err(|_| SE::BadUrlSyntax)?;
+ .map_err(|_| SpE::BadUrlSyntax)?;
url
}
}