Skip to content

fix: clean error when log directory creation fails - #358

Open
codythebeast89 wants to merge 1 commit into
ferrumc-rs:masterfrom
codythebeast89:fix/logging-init-error
Open

codythebeast89 wants to merge 1 commit into
ferrumc-rs:masterfrom
codythebeast89:fix/logging-init-error

Conversation

@codythebeast89

Copy link
Copy Markdown

Description

When the process cannot create or write the logs/ directory (for example, permission denied), FerrumC previously panicked on unwrap() during rolling-file appender init. Logging initialization now returns a thiserror result, and main prints a plain stderr message and exits with a non-zero status instead of a Rust panic.

Motivation and Context

Fixes #352.

How has this been tested?

  • cargo test -p ferrumc-logging --lib
  • cargo clippy -p ferrumc-logging --all-targets --no-deps -- -D warnings
  • cargo fmt --all -- --check
  • cargo check -p ferrumc
  • Unit coverage: actionable LoggingError Display text; Unix regression that an unwritable log dir returns PermissionDenied instead of panicking

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Refactor (restructuring code, without changing its behavior)

Checklist:

  • My code follows the code style of this project.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • Clippy passes with no warnings.

Made with Cursor

Permission errors while creating `logs/` previously panicked via
`unwrap()` on tracing-appender init. Propagate a thiserror result and
exit with a plain stderr message instead (ferrumc-rs#352).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Clean error message for permission error

1 participant