1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-01-11 08:33:43 -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 Bartek Iwańczuk
parent 0dac01be83
commit e0e03e3f6b
No known key found for this signature in database
GPG key ID: 0C6BCDDC3B3AD750

View file

@ -121,7 +121,7 @@ fn validate_cron_name(name: &str) -> Result<(), AnyError> {
if !name.chars().all(|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(())
}