refactor: clean up namespace errors
The namespace error was poorly refactored and duplicated the prefix string. The "rejected" case is now also tested.pull/24376/head
parent
3a9b5a4d29
commit
105e354299
|
@ -85,7 +85,7 @@ pub enum Error {
|
||||||
/// name into a [`NamespaceId`].
|
/// name into a [`NamespaceId`].
|
||||||
///
|
///
|
||||||
/// [`NamespaceId`]: data_types::NamespaceId
|
/// [`NamespaceId`]: data_types::NamespaceId
|
||||||
#[error("failed to resolve namespace ID: {0}")]
|
#[error(transparent)]
|
||||||
NamespaceResolver(#[from] crate::namespace_resolver::Error),
|
NamespaceResolver(#[from] crate::namespace_resolver::Error),
|
||||||
|
|
||||||
/// The router is currently servicing the maximum permitted number of
|
/// The router is currently servicing the maximum permitted number of
|
||||||
|
@ -561,7 +561,7 @@ mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::{
|
use crate::{
|
||||||
dml_handlers::mock::{MockDmlHandler, MockDmlHandlerCall},
|
dml_handlers::mock::{MockDmlHandler, MockDmlHandlerCall},
|
||||||
namespace_resolver::mock::MockNamespaceResolver,
|
namespace_resolver::{mock::MockNamespaceResolver, NamespaceCreationError},
|
||||||
};
|
};
|
||||||
use assert_matches::assert_matches;
|
use assert_matches::assert_matches;
|
||||||
use data_types::{NamespaceId, NamespaceNameError};
|
use data_types::{NamespaceId, NamespaceNameError};
|
||||||
|
@ -1513,10 +1513,16 @@ mod tests {
|
||||||
crate::namespace_resolver::Error::Lookup(e)
|
crate::namespace_resolver::Error::Lookup(e)
|
||||||
}),
|
}),
|
||||||
"failed to resolve namespace ID: \
|
"failed to resolve namespace ID: \
|
||||||
failed to resolve namespace ID: \
|
|
||||||
name [name] already exists",
|
name [name] already exists",
|
||||||
),
|
),
|
||||||
|
|
||||||
|
(
|
||||||
|
NamespaceResolver(
|
||||||
|
crate::namespace_resolver::Error::Create(NamespaceCreationError::Reject("bananas".to_string()))
|
||||||
|
),
|
||||||
|
"rejecting write due to non-existing namespace: bananas",
|
||||||
|
),
|
||||||
|
|
||||||
(
|
(
|
||||||
RequestLimit,
|
RequestLimit,
|
||||||
"this service is overloaded, please try again later",
|
"this service is overloaded, please try again later",
|
||||||
|
|
Loading…
Reference in New Issue