mirror of
https://github.com/meilisearch/meilisearch.git
synced 2025-07-28 01:01:00 +00:00
Change some error messages
This commit is contained in:
@ -187,7 +187,11 @@ impl Transform<'_, '_> {
|
||||
}
|
||||
}
|
||||
|
||||
return Err(UserError::MissingDocumentId { document: json }.into());
|
||||
return Err(UserError::MissingDocumentId {
|
||||
primary_key: primary_key_name,
|
||||
document: json,
|
||||
}
|
||||
.into());
|
||||
}
|
||||
|
||||
let uuid =
|
||||
|
@ -465,7 +465,8 @@ impl<'a, 't, 'u, 'i> Settings<'a, 't, 'u, 'i> {
|
||||
self.index.put_primary_key(self.wtxn, primary_key)?;
|
||||
Ok(())
|
||||
} else {
|
||||
Err(UserError::PrimaryKeyCannotBeChanged.into())
|
||||
let primary_key = self.index.primary_key(self.wtxn)?.unwrap();
|
||||
Err(UserError::PrimaryKeyCannotBeChanged(primary_key.to_string()).into())
|
||||
}
|
||||
}
|
||||
Setting::Reset => {
|
||||
@ -473,7 +474,8 @@ impl<'a, 't, 'u, 'i> Settings<'a, 't, 'u, 'i> {
|
||||
self.index.delete_primary_key(self.wtxn)?;
|
||||
Ok(())
|
||||
} else {
|
||||
Err(UserError::PrimaryKeyCannotBeReset.into())
|
||||
let primary_key = self.index.primary_key(self.wtxn)?.unwrap();
|
||||
Err(UserError::PrimaryKeyCannotBeChanged(primary_key.to_string()).into())
|
||||
}
|
||||
}
|
||||
Setting::NotSet => Ok(()),
|
||||
@ -1105,7 +1107,7 @@ mod tests {
|
||||
builder.reset_primary_key();
|
||||
|
||||
let err = builder.execute(|_, _| ()).unwrap_err();
|
||||
assert!(matches!(err, Error::UserError(UserError::PrimaryKeyCannotBeReset)));
|
||||
assert!(matches!(err, Error::UserError(UserError::PrimaryKeyCannotBeChanged(_))));
|
||||
wtxn.abort().unwrap();
|
||||
|
||||
// But if we clear the database...
|
||||
|
Reference in New Issue
Block a user