summaryrefslogtreecommitdiff
path: root/ext/cron/lib.rs
diff options
context:
space:
mode:
authorIan Bull <irbull@eclipsesource.com>2024-09-04 23:27:58 -0700
committerGitHub <noreply@github.com>2024-09-05 08:27:58 +0200
commit17b5e98b822dc23407a0292dcf61e624fbf2a4b1 (patch)
tree3c421242aea0e0c7b88b1e4766a2fae3127a88f7 /ext/cron/lib.rs
parentacd01eb2b41e37a480943f79cfa28fc220c4baca (diff)
refactor(ext/cron): align error messages (#25300)
Aligns the error messages in the cron extension to be in-line with the Deno style guide. https://github.com/denoland/deno/issues/25269
Diffstat (limited to 'ext/cron/lib.rs')
-rw-r--r--ext/cron/lib.rs7
1 files changed, 5 insertions, 2 deletions
diff --git a/ext/cron/lib.rs b/ext/cron/lib.rs
index ede01ba45..95e38179d 100644
--- a/ext/cron/lib.rs
+++ b/ext/cron/lib.rs
@@ -116,12 +116,15 @@ where
fn validate_cron_name(name: &str) -> Result<(), AnyError> {
if name.len() > 64 {
- return Err(type_error("Cron name is too long"));
+ return Err(type_error(format!(
+ "Cron name cannot exceed 64 characters: current length {}",
+ name.len()
+ )));
}
if !name.chars().all(|c| {
c.is_ascii_whitespace() || c.is_ascii_alphanumeric() || c == '_' || c == '-'
}) {
- return Err(type_error("Invalid cron name. Only alphanumeric characters, whitespace, hyphens, and underscores are allowed"));
+ return Err(type_error("Invalid cron name: only alphanumeric characters, whitespace, hyphens, and underscores are allowed"));
}
Ok(())
}