Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update error snapshots
Browse files Browse the repository at this point in the history
Signed-off-by: simonsan <14062932+simonsan@users.noreply.github.com>
simonsan committed Oct 30, 2024
1 parent b8bd50d commit e508412
Showing 3 changed files with 26 additions and 20 deletions.
14 changes: 7 additions & 7 deletions crates/core/tests/errors.rs
Original file line number Diff line number Diff line change
@@ -4,19 +4,19 @@ use rustic_core::{ErrorKind, RusticError, Severity, Status};

#[fixture]
fn error() -> Box<RusticError> {
RusticError::new(
RusticError::with_source(
ErrorKind::Io,
"A file could not be read, make sure the file is existing and readable by the system.",
std::io::Error::new(std::io::ErrorKind::Other, "networking error"),
)
.attach_context("path", "/path/to/file")
.attach_context("called", "used s3 backend")
.attach_status(Status::Permanent)
.attach_severity(Severity::Error)
.attach_error_code("C001")
.attach_context("path", "/path/to/file")
.attach_context("called", "used s3 backend")
.attach_source(std::io::Error::new(
std::io::ErrorKind::Other,
"networking error",
))
.append_guidance_line("Appended guidance line")
.prepend_guidance_line("Prepended guidance line")
.ask_report()
}

#[rstest]
25 changes: 13 additions & 12 deletions crates/core/tests/snapshots/errors__error_debug.snap
Original file line number Diff line number Diff line change
@@ -4,13 +4,7 @@ expression: error
---
RusticError {
kind: Io,
source: Some(
Custom {
kind: Other,
error: "networking error",
},
),
guidance: "A file could not be read, make sure the file is existing and readable by the system.",
guidance: "Prepended guidance line\nA file could not be read, make sure the file is existing and readable by the system.\nAppended guidance line",
context: [
(
"path",
@@ -21,18 +15,25 @@ RusticError {
"used s3 backend",
),
],
docs_url: None,
error_code: Some(
"C001",
source: Some(
Custom {
kind: Other,
error: "networking error",
},
),
new_issue_url: None,
existing_issue_url: None,
severity: Some(
Error,
),
status: Some(
Permanent,
),
docs_url: None,
error_code: Some(
"C001",
),
new_issue_url: None,
existing_issue_url: None,
ask_report: true,
backtrace: Some(
<disabled>,
),
7 changes: 6 additions & 1 deletion crates/core/tests/snapshots/errors__error_display.snap
Original file line number Diff line number Diff line change
@@ -5,7 +5,9 @@ expression: error
Input/Output Error occurred in `rustic_core`

Message:
Prepended guidance line
A file could not be read, make sure the file is existing and readable by the system.
Appended guidance line

Context:
path: /path/to/file,
@@ -19,7 +21,10 @@ Status: Permanent

For more information, see: https://rustic.cli.rs/docs/errors/C001

If you think this is an undiscovered bug, please open an issue at: https://github.com/rustic-rs/rustic_core/issues/new
We believe this is a bug, please report it by opening an issue at: https://github.com/rustic-rs/rustic_core/issues/new
If you can, please attach an anonymized debug log to the issue.

Thank you for helping us improve rustic!

Backtrace:
<disabled>

0 comments on commit e508412

Please sign in to comment.