Remove EppCommandResponseError alias
This is a direct alias for EppCommandResponse. It is documented as marking an error state, but type aliases aren't a great tool for that because the type system doesn't distinguish aliased types; if we want to do that seriously it should be a newtype wrapper.
This commit is contained in:
parent
f6ec331227
commit
91070576cd
|
@ -1,13 +1,13 @@
|
|||
//! Error types to wrap internal errors and make EPP errors easier to read
|
||||
|
||||
use crate::response::EppCommandResponseError;
|
||||
use crate::response::EppCommandResponse;
|
||||
use std::fmt::Display;
|
||||
|
||||
/// Error enum holding the possible error types
|
||||
#[derive(Debug)]
|
||||
pub enum Error {
|
||||
EppConnectionError(std::io::Error),
|
||||
EppCommandError(EppCommandResponseError),
|
||||
EppCommandError(EppCommandResponse),
|
||||
EppDeserializationError(String),
|
||||
Other(String),
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ pub enum Error {
|
|||
/// An EPP XML error
|
||||
#[derive(Debug)]
|
||||
pub struct EppCommandError {
|
||||
pub epp_error: EppCommandResponseError,
|
||||
pub epp_error: EppCommandResponse,
|
||||
}
|
||||
|
||||
impl std::error::Error for Error {}
|
||||
|
|
|
@ -8,8 +8,6 @@ use crate::common::{ElementName, EppObject, Extension, StringValue};
|
|||
|
||||
/// A generic EPP Response to an EPP command with a result section, a status code and a message
|
||||
pub type EppCommandResponse = EppObject<CommandResponseStatus>;
|
||||
/// An alias of `EppCommandResponse` indicating an EPP Error
|
||||
pub type EppCommandResponseError = EppCommandResponse;
|
||||
|
||||
/// Type corresponding to the <undef> tag an EPP response XML
|
||||
#[derive(Serialize, Deserialize, Debug, PartialEq)]
|
||||
|
|
|
@ -35,7 +35,7 @@ mod response {
|
|||
use crate::message::ack::MessageAck;
|
||||
use crate::message::poll::MessagePoll;
|
||||
use crate::request::EppRequest;
|
||||
use crate::response::EppCommandResponseError;
|
||||
use crate::response::EppCommandResponse;
|
||||
use crate::xml::EppXml;
|
||||
|
||||
const SVTRID: &str = "RO-6879-1627224678242975";
|
||||
|
@ -75,7 +75,7 @@ mod response {
|
|||
#[test]
|
||||
fn error() {
|
||||
let xml = get_xml("response/error.xml").unwrap();
|
||||
let object = EppCommandResponseError::deserialize(xml.as_str()).unwrap();
|
||||
let object = EppCommandResponse::deserialize(xml.as_str()).unwrap();
|
||||
|
||||
assert_eq!(object.data.result.code, 2303);
|
||||
assert_eq!(object.data.result.message, "Object does not exist".into());
|
||||
|
|
Loading…
Reference in New Issue