Change error name

This commit is contained in:
Mubelotix
2025-08-05 10:35:12 +02:00
parent 8a44d9faef
commit d340013d8b
2 changed files with 6 additions and 6 deletions

View File

@ -423,7 +423,7 @@ InvalidChatCompletionPreQueryPrompt , InvalidRequest , BAD_REQU
InvalidWebhooks , InvalidRequest , BAD_REQUEST ; InvalidWebhooks , InvalidRequest , BAD_REQUEST ;
InvalidWebhooksUrl , InvalidRequest , BAD_REQUEST ; InvalidWebhooksUrl , InvalidRequest , BAD_REQUEST ;
InvalidWebhooksHeaders , InvalidRequest , BAD_REQUEST ; InvalidWebhooksHeaders , InvalidRequest , BAD_REQUEST ;
ReservedWebhook , InvalidRequest , BAD_REQUEST ; ImmutableWebhook , InvalidRequest , BAD_REQUEST ;
InvalidWebhookUuid , InvalidRequest , BAD_REQUEST ; InvalidWebhookUuid , InvalidRequest , BAD_REQUEST ;
WebhookNotFound , InvalidRequest , NOT_FOUND ; WebhookNotFound , InvalidRequest , NOT_FOUND ;
ImmutableWebhookUuid , InvalidRequest , BAD_REQUEST ; ImmutableWebhookUuid , InvalidRequest , BAD_REQUEST ;

View File

@ -205,8 +205,8 @@ enum WebhooksError {
TooManyWebhooks, TooManyWebhooks,
#[error("Too many headers for the webhook `{0}`. Please limit the number of headers to 200.")] #[error("Too many headers for the webhook `{0}`. Please limit the number of headers to 200.")]
TooManyHeaders(Uuid), TooManyHeaders(Uuid),
#[error("Cannot edit webhook `{0}`. The webhook defined from the command line cannot be modified using the API.")] #[error("Webhook `{0}` is immutable. The webhook defined from the command line cannot be modified using the API.")]
ReservedWebhook(Uuid), ImmutableWebhook(Uuid),
#[error("Webhook `{0}` not found.")] #[error("Webhook `{0}` not found.")]
WebhookNotFound(Uuid), WebhookNotFound(Uuid),
#[error("Invalid header name `{0}`: {1}")] #[error("Invalid header name `{0}`: {1}")]
@ -225,7 +225,7 @@ impl ErrorCode for WebhooksError {
MissingUrl(_) => meilisearch_types::error::Code::InvalidWebhooksUrl, MissingUrl(_) => meilisearch_types::error::Code::InvalidWebhooksUrl,
TooManyWebhooks => meilisearch_types::error::Code::InvalidWebhooks, TooManyWebhooks => meilisearch_types::error::Code::InvalidWebhooks,
TooManyHeaders(_) => meilisearch_types::error::Code::InvalidWebhooksHeaders, TooManyHeaders(_) => meilisearch_types::error::Code::InvalidWebhooksHeaders,
ReservedWebhook(_) => meilisearch_types::error::Code::ReservedWebhook, ImmutableWebhook(_) => meilisearch_types::error::Code::ImmutableWebhook,
WebhookNotFound(_) => meilisearch_types::error::Code::WebhookNotFound, WebhookNotFound(_) => meilisearch_types::error::Code::WebhookNotFound,
InvalidHeaderName(_, _) => meilisearch_types::error::Code::InvalidWebhooksHeaders, InvalidHeaderName(_, _) => meilisearch_types::error::Code::InvalidWebhooksHeaders,
InvalidHeaderValue(_, _) => meilisearch_types::error::Code::InvalidWebhooksHeaders, InvalidHeaderValue(_, _) => meilisearch_types::error::Code::InvalidWebhooksHeaders,
@ -278,7 +278,7 @@ fn patch_webhook_inner(
fn check_changed(uuid: Uuid, webhook: &Webhook) -> Result<(), WebhooksError> { fn check_changed(uuid: Uuid, webhook: &Webhook) -> Result<(), WebhooksError> {
if uuid.is_nil() { if uuid.is_nil() {
return Err(ReservedWebhook(uuid)); return Err(ImmutableWebhook(uuid));
} }
if webhook.url.is_empty() { if webhook.url.is_empty() {
@ -467,7 +467,7 @@ async fn delete_webhook(
debug!(parameters = ?uuid, "Delete webhook"); debug!(parameters = ?uuid, "Delete webhook");
if uuid.is_nil() { if uuid.is_nil() {
return Err(ReservedWebhook(uuid).into()); return Err(ImmutableWebhook(uuid).into());
} }
let mut webhooks = index_scheduler.webhooks(); let mut webhooks = index_scheduler.webhooks();