Check a single POD against a POD Request (#359)

This commit is contained in:
Rob Knight 2025-07-30 02:46:14 +01:00 committed by GitHub
parent c7b39f21f0
commit f10a5adb41
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 419 additions and 102 deletions

View file

@ -31,6 +31,10 @@ pub enum InnerError {
),
#[error("invalid arguments to {0} operation")]
OpInvalidArgs(String),
#[error("Podlang parse error: {0}")]
PodlangParse(String),
#[error("POD Request validation error: {0}")]
PodRequestValidation(String),
// Other
#[error("{0}")]
Custom(String),
@ -55,6 +59,12 @@ impl From<std::convert::Infallible> for Error {
}
}
impl From<crate::lang::LangError> for Error {
fn from(value: crate::lang::LangError) -> Self {
Error::podlang_parse(value)
}
}
impl Debug for Error {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
std::fmt::Display::fmt(self, f)
@ -88,4 +98,10 @@ impl Error {
pub(crate) fn max_length(obj: String, found: usize, expect: usize) -> Self {
new!(MaxLength(obj, found, expect))
}
pub(crate) fn podlang_parse(e: crate::lang::LangError) -> Self {
new!(PodlangParse(e.to_string()))
}
pub(crate) fn pod_request_validation(e: String) -> Self {
new!(PodRequestValidation(e))
}
}