fix: Use expect rather than returning error in a theoretically impossible case

pull/24376/head
Carol (Nichols || Goulding) 2023-06-07 11:35:31 -04:00
parent d0db1194e2
commit 2becc950e1
No known key found for this signature in database
GPG Key ID: E907EE5A736F87D4
2 changed files with 3 additions and 7 deletions

View File

@ -146,11 +146,6 @@ pub enum Error {
#[snafu(display("could not delete namespace: {source}"))]
CouldNotDeleteNamespace { source: sqlx::Error },
#[snafu(display("invalid partition template: {source}"))]
InvalidPartitionTemplate {
source: data_types::partition_template::ValidationError,
},
}
/// A specialized `Error` for Catalog errors

View File

@ -227,9 +227,10 @@ where
table_name,
// This table is being created implicitly by this write, so there's no
// possibility of a user-supplied partition template here, which is why there's
// a hardcoded `None`.
// a hardcoded `None`. If there is a namespace template, it must be valid because
// validity was checked during its creation, so that's why there's an `expect`.
TablePartitionTemplateOverride::try_new(None, namespace_partition_template)
.map_err(|source| Error::InvalidPartitionTemplate { source })?,
.expect("no table partition template; namespace partition template has been validated"),
namespace_id,
)
.await;