fix: Use expect rather than returning error in a theoretically impossible case
parent
d0db1194e2
commit
2becc950e1
|
@ -146,11 +146,6 @@ pub enum Error {
|
||||||
|
|
||||||
#[snafu(display("could not delete namespace: {source}"))]
|
#[snafu(display("could not delete namespace: {source}"))]
|
||||||
CouldNotDeleteNamespace { source: sqlx::Error },
|
CouldNotDeleteNamespace { source: sqlx::Error },
|
||||||
|
|
||||||
#[snafu(display("invalid partition template: {source}"))]
|
|
||||||
InvalidPartitionTemplate {
|
|
||||||
source: data_types::partition_template::ValidationError,
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A specialized `Error` for Catalog errors
|
/// A specialized `Error` for Catalog errors
|
||||||
|
|
|
@ -227,9 +227,10 @@ where
|
||||||
table_name,
|
table_name,
|
||||||
// This table is being created implicitly by this write, so there's no
|
// 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
|
// 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)
|
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,
|
namespace_id,
|
||||||
)
|
)
|
||||||
.await;
|
.await;
|
||||||
|
|
Loading…
Reference in New Issue