diff --git a/src/cfdp/pdu/eof.rs b/src/cfdp/pdu/eof.rs index 71f977b..16f2bba 100644 --- a/src/cfdp/pdu/eof.rs +++ b/src/cfdp/pdu/eof.rs @@ -106,7 +106,7 @@ impl EofPdu { } generic_length_checks_pdu_deserialization(buf, min_expected_len, full_len_without_crc)?; let directive_type = FileDirectiveType::try_from(buf[current_idx]).map_err(|_| { - PduError::InvalidDirectiveType((buf[current_idx], FileDirectiveType::EofPdu)) + PduError::InvalidDirectiveType((buf[current_idx], Some(FileDirectiveType::EofPdu))) })?; if directive_type != FileDirectiveType::EofPdu { return Err(PduError::WrongDirectiveType(( diff --git a/src/cfdp/pdu/finished.rs b/src/cfdp/pdu/finished.rs index 29cf747..463ca8d 100644 --- a/src/cfdp/pdu/finished.rs +++ b/src/cfdp/pdu/finished.rs @@ -170,7 +170,7 @@ impl<'fs_responses> FinishedPdu<'fs_responses> { let min_expected_len = current_idx + 2; generic_length_checks_pdu_deserialization(buf, min_expected_len, full_len_without_crc)?; let directive_type = FileDirectiveType::try_from(buf[current_idx]).map_err(|_| { - PduError::InvalidDirectiveType((buf[current_idx], FileDirectiveType::FinishedPdu)) + PduError::InvalidDirectiveType((buf[current_idx], Some(FileDirectiveType::FinishedPdu))) })?; if directive_type != FileDirectiveType::FinishedPdu { return Err(PduError::WrongDirectiveType(( diff --git a/src/cfdp/pdu/metadata.rs b/src/cfdp/pdu/metadata.rs index 2e3b5f0..fe2e4d2 100644 --- a/src/cfdp/pdu/metadata.rs +++ b/src/cfdp/pdu/metadata.rs @@ -248,7 +248,7 @@ impl<'src_name, 'dest_name, 'opts> MetadataPdu<'src_name, 'dest_name, 'opts> { } generic_length_checks_pdu_deserialization(buf, min_expected_len, full_len_without_crc)?; let directive_type = FileDirectiveType::try_from(buf[current_idx]).map_err(|_| { - PduError::InvalidDirectiveType((buf[current_idx], FileDirectiveType::MetadataPdu)) + PduError::InvalidDirectiveType((buf[current_idx], Some(FileDirectiveType::MetadataPdu))) })?; if directive_type != FileDirectiveType::MetadataPdu { return Err(PduError::WrongDirectiveType(( diff --git a/src/cfdp/pdu/mod.rs b/src/cfdp/pdu/mod.rs index d015d99..729a88a 100644 --- a/src/cfdp/pdu/mod.rs +++ b/src/cfdp/pdu/mod.rs @@ -43,8 +43,8 @@ pub enum PduError { WrongDirectiveType((FileDirectiveType, FileDirectiveType)), /// The directive type field contained a value not in the range of permitted values. /// The first tuple entry will be the found raw number, the second entry the expected entry - /// type. - InvalidDirectiveType((u8, FileDirectiveType)), + /// type when applicable. + InvalidDirectiveType((u8, Option)), /// Invalid condition code. Contains the raw detected value. InvalidConditionCode(u8), /// Invalid checksum type which is not part of the checksums listed in the @@ -101,8 +101,7 @@ impl Display for PduError { PduError::InvalidDirectiveType((found, expected)) => { write!( f, - "invalid directive type value {found}, expected {expected:?} ({})", - *expected as u8 + "invalid directive type value {found}, expected {expected:?}" ) } PduError::InvalidChecksumType(checksum_type) => {