# ReplayError
*Requires feature `journal`.*
An error returned by [`InMemoryJournal::replay`](in_memory_journal.md) when
the machine's decisions diverge from the recorded history.
## Construction and Accessors
```rust
use ready_active_safe::journal::{ReplayError, ReplayMismatch};
let err = ReplayError::new(3, ReplayMismatch::ToMode);
assert_eq!(err.step(), 3);
assert_eq!(err.mismatch(), ReplayMismatch::ToMode);
```
## Display
```rust
use ready_active_safe::journal::{ReplayError, ReplayMismatch};
let err = ReplayError::new(3, ReplayMismatch::ToMode);
assert_eq!(
err.to_string(),
"replay diverged at step 3: computed next mode differs from recorded mode",
);
```
## `ReplayMismatch` Variants
### `FromMode`
The current mode at a step differs from the recorded `from` mode.
```rust
use ready_active_safe::journal::ReplayMismatch;
let m = ReplayMismatch::FromMode;
assert_eq!(m.to_string(), "current mode differs from recorded starting mode");
```
### `ToMode`
The computed next mode differs from the recorded `to` mode.
```rust
use ready_active_safe::journal::ReplayMismatch;
let m = ReplayMismatch::ToMode;
assert_eq!(m.to_string(), "computed next mode differs from recorded mode");
```
### `Commands`
The computed commands differ from the recorded commands.
```rust
use ready_active_safe::journal::ReplayMismatch;
let m = ReplayMismatch::Commands;
assert_eq!(m.to_string(), "computed commands differ from recorded commands");
```
## See Also
- [`InMemoryJournal::replay`](in_memory_journal.md) — the method that produces this error
- [`TransitionRecord`](transition_record.md) — the records being replayed