1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-24 15:19:26 -05:00

fix(cron): improve error message for invalid cron names (#24644)

When a cron name is invalid, it wasn't necessarily clear why. This
change-set improves the error message to inform the user of the valid
characters in a cron name.
This commit is contained in:
Ian Bull 2024-07-18 13:52:17 -07:00 committed by GitHub
parent d80d0cea7c
commit 1722e0aebf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -121,7 +121,7 @@ fn validate_cron_name(name: &str) -> Result<(), AnyError> {
if !name.chars().all(|c| { if !name.chars().all(|c| {
c.is_ascii_whitespace() || c.is_ascii_alphanumeric() || c == '_' || c == '-' c.is_ascii_whitespace() || c.is_ascii_alphanumeric() || c == '_' || c == '-'
}) { }) {
return Err(type_error("Invalid cron name")); return Err(type_error("Invalid cron name. Only alphanumeric characters, whitespace, hyphens, and underscores are allowed"));
} }
Ok(()) Ok(())
} }