Throw error for unexpected input length for Fingerprint.
This commit is contained in:
parent
6cfe340d2b
commit
891b57df06
1 changed files with 7 additions and 5 deletions
|
@ -28,11 +28,13 @@ impl TryFrom<&[u8]> for Fingerprint {
|
||||||
input.len()
|
input.len()
|
||||||
);
|
);
|
||||||
|
|
||||||
// FIXME: return error
|
if input.len() == 20 {
|
||||||
assert_eq!(input.len(), 20);
|
let array: [u8; 20] = input.try_into().unwrap();
|
||||||
|
Ok(array.into())
|
||||||
let array: [u8; 20] = input.try_into().unwrap();
|
} else {
|
||||||
Ok(array.into())
|
Err(anyhow!("Unexpected fingerprint length {}", input.len())
|
||||||
|
.into())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue