-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Ignore to current Bolt implementation (#204)
* Implement ignore to possible responses for summary for current bolt implementation * Run cargo fmt * Fix clippy warnings --------- Co-authored-by: Paul Horn <[email protected]>
- Loading branch information
1 parent
4ac6f6a
commit a56e2d2
Showing
3 changed files
with
54 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
use crate::errors::Neo4jError; | ||
use neo4rs_macros::BoltStruct; | ||
|
||
#[derive(Debug, PartialEq, Clone, BoltStruct)] | ||
#[signature(0xB0, 0x7E)] | ||
pub struct Ignore; | ||
|
||
impl Ignore { | ||
pub(crate) fn into_error(self) -> Neo4jError { | ||
Neo4jError::new( | ||
"Neo.ServerError.Ignored".into(), | ||
"The request was ignored by the server because it is in a FAILED or INTERRUPTED state" | ||
.into(), | ||
) | ||
} | ||
} | ||
|
||
#[cfg(test)] | ||
mod tests { | ||
use super::*; | ||
use crate::types::BoltWireFormat; | ||
use crate::version::Version; | ||
use bytes::Bytes; | ||
|
||
#[test] | ||
fn should_deserialize_success() { | ||
let mut data = Bytes::from_static(&[0xB0, 0x7E]); | ||
|
||
let failure: Ignore = Ignore::parse(Version::V4_1, &mut data).unwrap(); | ||
let failure = failure.into_error(); | ||
|
||
assert_eq!(failure.code(), "Neo.ServerError.Ignored"); | ||
assert_eq!( | ||
failure.message(), | ||
"The request was ignored by the server because it is in a FAILED or INTERRUPTED state" | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters