Skip to content

Self-wrapping error detection#48

Open
Adam-Kay wants to merge 5 commits intomainfrom
self-wrapper
Open

Self-wrapping error detection#48
Adam-Kay wants to merge 5 commits intomainfrom
self-wrapper

Conversation

@Adam-Kay
Copy link
Copy Markdown
Owner

@Adam-Kay Adam-Kay commented Jan 22, 2024

Introduction of new system whereby the programs wraps itself in itself as a container and monitors the internal program for critical errors (crashes). It can then safely handle these and show a message to the user before exiting.

Related issues:

Createlist:

Separate1 the Critical Error (code 3) into:

  • Encoding Error (code 4)
    • for when something goes wrong during an encode (ffmpeg fails, output file does not exist or has wrong length)
  • Critical Program Error (code 5)
    • for when the program crashes and the external wrapper has to catch it and produce an error

Testlist:

  • Exiting program via entering N at first confirmation works
    • (program exits with no error messages as well as a clean %ERRORLEVEL%)
  • Force exiting program via CTRL+C works
    • (program can exit without or with error message, as long as it's one or less)
  • On Update Error, program restarts correctly
  • On Encoding Error, program exits with one error message and an error code of 4
  • On Critical Program Error, program crashes gracefully using external wrapper with only one error message and an error code of 5

then

  • After restart (for instance as a result of update error), ensure all of the above still work correctly

Footnotes

  1. These are separated into new codes so that 3 ends up somewhat 'deprecated'.
     

Has potential to handle all future critical errors cleanly
Also babyproofed some delete statements. In rare cases, they would suggest to the user if they wanted to delete the entire directory ('del ""' is dangerous).
@Adam-Kay Adam-Kay added bug Something isn't working enhancement New feature or request labels Jan 22, 2024
@Adam-Kay Adam-Kay self-assigned this Jan 22, 2024
@Adam-Kay
Copy link
Copy Markdown
Owner Author

Adam-Kay commented Jan 22, 2024

Ideas from this SO thread might help determine if the program was launched by double-click or from terminal - in theory this should not matter but if I have to force behavior, this is how I'd do it.

@Adam-Kay
Copy link
Copy Markdown
Owner Author

Midnote

This project may benefit from a step back and re-attempt from scratch (< 69792ad), as code has gotten messy with comments and debugging for issues.

@Adam-Kay Adam-Kay mentioned this pull request Jan 23, 2024
4 tasks
@Adam-Kay
Copy link
Copy Markdown
Owner Author

Two commits are missing from this branch and should be removed from main and added here:

@Adam-Kay
Copy link
Copy Markdown
Owner Author

Adam-Kay commented Jan 23, 2024

comment:

Two commits are missing from this branch and should be removed from main and added here

So, rebasing the main & self-wrapper branches and force pushing was scary but I think in theory this works.

@Adam-Kay
Copy link
Copy Markdown
Owner Author

History now reset to how it was before the rebase. Going to attempt again but preserving the dates this time.

@Adam-Kay
Copy link
Copy Markdown
Owner Author

Adam-Kay commented Jan 23, 2024

Rebase is complete with intact history (though hashes will have changed)

For reference, the command used for rebasing was:

git rebase --interactive --rebase-merges --committer-date-is-author-date 7f7cdd4

Though I'm not sure --rebase-merges was necessary.

@Adam-Kay
Copy link
Copy Markdown
Owner Author

Adam-Kay commented Jan 28, 2024

Added new tasks into PR description.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

End of program error: The batch file cannot be found.

1 participant