Add max input POD check to MainPodBuilder (#440)

This commit is contained in:
Ahmad Afuni 2025-12-08 23:23:51 +10:00 committed by GitHub
parent 42f979c408
commit 32dc85471d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 16 additions and 4 deletions

View file

@ -35,6 +35,8 @@ pub enum InnerError {
PodlangParse(String),
#[error("POD Request validation error: {0}")]
PodRequestValidation(String),
#[error("Too many input PODs provided: {0} were provided, but the maximum is {1}")]
TooManyInputPods(usize, usize),
#[error("Too many public statements provided: {0} were provided, but the maximum is {1}")]
TooManyPublicStatements(usize, usize),
#[error("Too many statements provided: {0} were provided, but the maximum is {1}")]
@ -108,6 +110,9 @@ impl Error {
pub(crate) fn pod_request_validation(e: String) -> Self {
new!(PodRequestValidation(e))
}
pub(crate) fn too_many_input_pods(found: usize, max: usize) -> Self {
new!(TooManyInputPods(found, max))
}
pub(crate) fn too_many_public_statements(found: usize, max: usize) -> Self {
new!(TooManyPublicStatements(found, max))
}