Refactor Exceptions: remove ScreenshotException. add OperationFailedExceptionWithScreenshot. - #1431
Merged
Merged
Conversation
jw098
marked this pull request as draft
August 27, 2026 17:26
Mysticial
reviewed
Aug 28, 2026
| e.send_notification(env, m_option.instance().NOTIFICATION_ERROR_FATAL); | ||
| send_program_fatal_error_notification(env, m_option.instance().NOTIFICATION_ERROR_FATAL, e.message(), *e.screenshot()); | ||
| if (e.error_report_mode() == ErrorReport::SEND_ERROR_REPORT){ | ||
| PokemonAutomation::report_error( |
Collaborator
There was a problem hiding this comment.
If this pattern appears 35 times, then that's a lot of places to copy-paste inline it. Can you add back a helper function somewhere that does this?
Collaborator
Author
There was a problem hiding this comment.
So, basically, you want to go from this:
send_program_fatal_error_notification(env, m_option.instance().NOTIFICATION_ERROR_FATAL, e.message(), *e.screenshot());
if (e.error_report_mode() == ErrorReport::SEND_ERROR_REPORT){
PokemonAutomation::report_error(
&env.logger(),
env.program_info(),
"Fatal: OperationFailedExceptionWithScreenshot",
{{"Message:", e.message()}},
*e.screenshot(),
&e.video_stream()->history()
);
}
to this?
send_program_fatal_error_notification_and_telemetry_report(
env, &env.logger(), env.program_info(),
m_option.instance().NOTIFICATION_ERROR_FATAL,
e.error_report_mode(),
e.message(),
"OperationFailedExceptionWithScreenshot",
*e.screenshot(),
&e.video_stream()->history()
);
Collaborator
There was a problem hiding this comment.
No I mean back to a one-line function call like what it was before. I don't necessarily mean revert it, but make a helper function that does that.
Basically copying the same 10 lines 35 times when it's a clean 1 line each is not great.
…edException. OperationFailedException now directly inherits exception.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Unfortunately, this is a massive PR.
I think the main things to review are all the files within Exception/. And the ProgramSessions, where the exceptions are caught.