mirror of
https://github.com/meilisearch/MeiliSearch
synced 2025-06-14 20:11:38 +02:00
Use a Regex in insta dynamic redaction to replace Uuids with [uuid]
Signed-off-by: Martin Tzvetanov Grigorov <mgrigorov@apache.org>
This commit is contained in:
parent
ce9c930d10
commit
f3d691667d
@ -126,7 +126,7 @@ pub enum Error {
|
|||||||
#[error(transparent)]
|
#[error(transparent)]
|
||||||
Heed(#[from] heed::Error),
|
Heed(#[from] heed::Error),
|
||||||
#[error("{}", match .index_uid {
|
#[error("{}", match .index_uid {
|
||||||
Some(uid) if !uid.is_empty() => format!("Index `{}`: {error}", Error::index_name(uid)),
|
Some(uid) if !uid.is_empty() => format!("Index `{}`: {error}", uid),
|
||||||
_ => format!("{error}")
|
_ => format!("{error}")
|
||||||
})]
|
})]
|
||||||
Milli { error: milli::Error, index_uid: Option<String> },
|
Milli { error: milli::Error, index_uid: Option<String> },
|
||||||
@ -177,17 +177,6 @@ pub enum Error {
|
|||||||
PlannedFailure,
|
PlannedFailure,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Error {
|
|
||||||
#[inline]
|
|
||||||
fn index_name(index_name: &str) -> &str {
|
|
||||||
if uuid::Uuid::parse_str(index_name).is_ok() {
|
|
||||||
"[uuid]"
|
|
||||||
} else {
|
|
||||||
index_name
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug, thiserror::Error)]
|
#[derive(Debug, thiserror::Error)]
|
||||||
#[error(
|
#[error(
|
||||||
"{disabled_action} requires enabling the `{feature}` experimental feature. See {issue_link}"
|
"{disabled_action} requires enabling the `{feature}` experimental feature. See {issue_link}"
|
||||||
|
@ -55,6 +55,14 @@ pub fn default_snapshot_settings_for_test<'a>(
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
settings.add_dynamic_redaction(".error.message", |content, _content_path| match &content {
|
||||||
|
Content::String(s) => {
|
||||||
|
let uuid_replaced = UUID_IN_MESSAGE_RE.replace_all(s, "$before[uuid]$after");
|
||||||
|
Content::String(uuid_replaced.to_string())
|
||||||
|
}
|
||||||
|
_ => content,
|
||||||
|
});
|
||||||
|
|
||||||
let test_name = test_name.strip_suffix("::{{closure}}").unwrap_or(test_name);
|
let test_name = test_name.strip_suffix("::{{closure}}").unwrap_or(test_name);
|
||||||
let test_name = test_name.rsplit("::").next().unwrap().to_owned();
|
let test_name = test_name.rsplit("::").next().unwrap().to_owned();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user