Skip to content

Add different error handling behaviors for disk writing errors#75

Merged
sushichop merged 1 commit intosushichop:mainfrom
KaiOelfke:main
Jan 29, 2023
Merged

Add different error handling behaviors for disk writing errors#75
sushichop merged 1 commit intosushichop:mainfrom
KaiOelfke:main

Conversation

@KaiOelfke
Copy link
Copy Markdown
Contributor

I was using Puppy during debugging a low disk space scenario. One crash was actually a side effect of logging with Puppy. The disk write failed due to low disk space. Using force trying to log is not always the right behavior for each logging use case.

Screenshot 2023-01-24 at 09 59 29

For this scenario it's better to potentially lose some logs than to crash the app.

This PR adds two more error handling strategies for disk writes. There may be other valid error handling strategies.

  • assert uses assertionFailure to stop execution for debug builds and ignores failures in release builds
  • print only prints the error message to the standard output

The default option force has the current behavior. So this shouldn't be a breaking change, but allows Puppy users to pick a different behavior, when useful.

For example when logging during a low disk space scenario it may be preferable to lose logs over crashing the app.
@sushichop
Copy link
Copy Markdown
Owner

@KaiOelfke
This use case is very helpful.
Thanks for your excellent pull request!

@sushichop sushichop merged commit 5b2ad46 into sushichop:main Jan 29, 2023
sushichop added a commit that referenced this pull request Jan 30, 2023
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.

2 participants