From 7ecb43f40fa3a05a81fe2b4f9e4949978663c5ac Mon Sep 17 00:00:00 2001 From: jw098 Date: Tue, 25 Aug 2026 17:38:01 -0700 Subject: [PATCH 01/15] remove usage of ScreenshotException::send_recoverable_notification --- .../Programs/Eggs/PokemonSV_EggAutonomous.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/SerialPrograms/Source/PokemonSV/Programs/Eggs/PokemonSV_EggAutonomous.cpp b/SerialPrograms/Source/PokemonSV/Programs/Eggs/PokemonSV_EggAutonomous.cpp index 1f1d529852..9df38b0128 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/Eggs/PokemonSV_EggAutonomous.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/Eggs/PokemonSV_EggAutonomous.cpp @@ -6,6 +6,7 @@ #include #include "CommonFramework/StaticGlobals.h" +#include "CommonFramework/ErrorReports/ErrorReports.h" #include "CommonFramework/Exceptions/ProgramFinishedException.h" #include "CommonFramework/Exceptions/FatalProgramException.h" #include "CommonFramework/Exceptions/OperationFailedException.h" @@ -840,7 +841,18 @@ bool EggAutonomous::handle_recoverable_error( env.console ); } - e.send_recoverable_notification(env); + + auto snapshot = env.console.video().snapshot().frame; + std::string message = fail_message; + send_program_recoverable_error_notification(env, NOTIFICATION_ERROR_RECOVERABLE, message, *snapshot); + report_error( + &env.logger(), + env.program_info(), + "Recoverable: OperationFailedExceptionWithScreenshot", + {{"Message:", message}}, + *snapshot, + &env.console.history() + ); env.log("Reset game to handle recoverable error"); reset_game(env.program_info(), env.console, context); From 17d4405f9d51f0dbd6610b67d8a1252c069773dc Mon Sep 17 00:00:00 2001 From: jw098 Date: Tue, 25 Aug 2026 23:17:23 -0700 Subject: [PATCH 02/15] add OperationFailedExceptionWithScreenshot --- ...OperationFailedExceptionWithScreenshot.cpp | 85 ++++++++++++++++++ .../OperationFailedExceptionWithScreenshot.h | 88 +++++++++++++++++++ ...ntendoSwitch_MultiSwitchProgramSession.cpp | 21 +++++ ...tendoSwitch_SingleSwitchProgramSession.cpp | 21 +++++ SerialPrograms/cmake/SourceFiles.cmake | 2 + 5 files changed, 217 insertions(+) create mode 100644 SerialPrograms/Source/CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.cpp create mode 100644 SerialPrograms/Source/CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h diff --git a/SerialPrograms/Source/CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.cpp b/SerialPrograms/Source/CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.cpp new file mode 100644 index 0000000000..becfb53b66 --- /dev/null +++ b/SerialPrograms/Source/CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.cpp @@ -0,0 +1,85 @@ +/* Operation Failed Exception with Screenshot + * + * From: https://github.com/PokemonAutomation/ + * + */ + +#include "CommonFramework/ImageTypes/ImageRGB32.h" +#include "CommonFramework/ErrorReports/ErrorReports.h" +#include "CommonFramework/Notifications/ProgramNotifications.h" +#include "CommonFramework/VideoPipeline/VideoFeed.h" +#include "CommonFramework/Tools/VideoStream.h" +#include "CommonFramework/Tools/ProgramEnvironment.h" +#include "OperationFailedExceptionWithScreenshot.h" + +//#include +//using std::cout; +//using std::endl; + +namespace PokemonAutomation{ + + + +OperationFailedExceptionWithScreenshot::OperationFailedExceptionWithScreenshot( + std::string message, + VideoStream& stream +) + : m_message(std::move(message)) + , m_stream(&stream) + , m_screenshot(stream.video().snapshot().frame) +{ + if (m_screenshot == nullptr || !*m_screenshot){ + stream.log("Camera returned empty screenshot. Is the camera frozen?", COLOR_RED); + } +} +OperationFailedExceptionWithScreenshot::OperationFailedExceptionWithScreenshot( + std::string message, + VideoStream* stream, + ImageRGB32 screenshot +) + : m_message(std::move(message)) + , m_stream(stream) + , m_screenshot(std::make_shared(std::move(screenshot))) +{} +OperationFailedExceptionWithScreenshot::OperationFailedExceptionWithScreenshot( + std::string message, + VideoStream* stream, + std::shared_ptr screenshot +) + : m_message(std::move(message)) + , m_stream(stream) + , m_screenshot(std::move(screenshot)) +{} + + +// void ScreenshotException::add_stream_if_needed(VideoStream& stream){ +// if (m_stream == nullptr){ +// m_stream = &stream; +// } +// if (!m_screenshot){ +// m_screenshot = stream.video().snapshot(); +// if (m_screenshot == nullptr || !*m_screenshot){ +// stream.log("Camera returned empty screenshot. Is the camera frozen?", COLOR_RED); +// } +// } +// } + +ImageViewRGB32 OperationFailedExceptionWithScreenshot::screenshot_view() const{ + if (m_screenshot){ + return *m_screenshot; + }else{ + return ImageViewRGB32(); + } +} +std::shared_ptr OperationFailedExceptionWithScreenshot::screenshot() const{ + return m_screenshot; +} + +VideoStream* OperationFailedExceptionWithScreenshot::video_stream() const{ + return m_stream; +} + + + + +} diff --git a/SerialPrograms/Source/CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h b/SerialPrograms/Source/CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h new file mode 100644 index 0000000000..1ccd5a4c5f --- /dev/null +++ b/SerialPrograms/Source/CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h @@ -0,0 +1,88 @@ +/* Operation Failed Exception with Screenshot + * + * From: https://github.com/PokemonAutomation/ + * + */ + +#ifndef PokemonAutomation_OperationFailedExceptionWithScreenshot_H +#define PokemonAutomation_OperationFailedExceptionWithScreenshot_H + +#include +#include "CommonFramework/Tools/VideoStream.h" +#include "Common/Cpp/Exceptions.h" + +namespace PokemonAutomation{ + +class ImageViewRGB32; +class ImageRGB32; +// class EventNotificationOption; +// class VideoStream; +// struct ProgramInfo; +// class ProgramEnvironment; + + +// Thrown by subroutines if they fail for an in-game reason. +// These include recoverable errors which can be consumed by the program. +class OperationFailedExceptionWithScreenshot : public Exception{ +public: + OperationFailedExceptionWithScreenshot( + std::string message, + VideoStream& stream + ); + + // Construct exception with message with screenshot and (optionally) console information. + // Use the provided screenshot instead of taking one with the console. + // Store the console information (if provided) for stream history if requested later. + OperationFailedExceptionWithScreenshot( + std::string message, + VideoStream* stream, + ImageRGB32 screenshot + ); + OperationFailedExceptionWithScreenshot( + std::string message, + VideoStream* stream, + std::shared_ptr screenshot + ); + + // This is the most common use case. Throw and log exception. + // Include console information for screenshot and stream history. + [[noreturn]] static void fire( + std::string message, + VideoStream& stream + ){ + throw_and_log( + stream.logger(), + std::move(message), + stream + ); + } + [[noreturn]] static void fire( + std::string message, + VideoStream& stream, + std::shared_ptr screenshot + ){ + throw_and_log( + stream.logger(), + std::move(message), + &stream, + std::move(screenshot) + ); + } + + virtual const char* name() const override{ return "OperationFailedExceptionWithScreenshot"; } + ImageViewRGB32 screenshot_view() const; + std::shared_ptr screenshot() const; + VideoStream* video_stream() const; + +public: + std::string m_message; + VideoStream* m_stream = nullptr; + std::shared_ptr m_screenshot; +}; + + + + + +} +#endif diff --git a/SerialPrograms/Source/NintendoSwitch/Framework/NintendoSwitch_MultiSwitchProgramSession.cpp b/SerialPrograms/Source/NintendoSwitch/Framework/NintendoSwitch_MultiSwitchProgramSession.cpp index 425c135532..ab087b621a 100644 --- a/SerialPrograms/Source/NintendoSwitch/Framework/NintendoSwitch_MultiSwitchProgramSession.cpp +++ b/SerialPrograms/Source/NintendoSwitch/Framework/NintendoSwitch_MultiSwitchProgramSession.cpp @@ -8,7 +8,9 @@ #include "Common/Cpp/EarlyShutdown.h" #include "Common/Cpp/Concurrency/SpinPause.h" #include "Common/Cpp/Containers/FixedLimitVector.tpp" +#include "CommonFramework/ErrorReports/ErrorReports.h" #include "CommonFramework/GlobalSettingsPanel.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/Exceptions/ProgramFinishedException.h" #include "CommonFramework/Notifications/ProgramInfo.h" #include "CommonFramework/Notifications/ProgramNotifications.h" @@ -247,6 +249,25 @@ void MultiSwitchProgramSession::internal_run_program(){ message = e.name(); } report_error(message); + }catch (OperationFailedExceptionWithScreenshot& e){ + logger().log("Program stopped with an exception!", COLOR_RED); + env.add_overlay_log_to_all_consoles("- Program Error -", COLOR_RED); + + std::string message = e.message(); + if (message.empty()){ + message = e.name(); + } + report_error(message); + send_program_fatal_error_notification(env, m_option.instance().NOTIFICATION_ERROR_FATAL, e.message(), *e.screenshot()); + PokemonAutomation::report_error( + &env.logger(), + env.program_info(), + "Recoverable: OperationFailedExceptionWithScreenshot", + {{"Message:", e.message()}}, + *e.screenshot(), + &e.video_stream()->history() + ); + }catch (ScreenshotException& e){ logger().log("Program stopped with an exception!", COLOR_RED); env.add_overlay_log_to_all_consoles("- Program Error -", COLOR_RED); diff --git a/SerialPrograms/Source/NintendoSwitch/Framework/NintendoSwitch_SingleSwitchProgramSession.cpp b/SerialPrograms/Source/NintendoSwitch/Framework/NintendoSwitch_SingleSwitchProgramSession.cpp index ad53ed8df8..9f2b84dccf 100644 --- a/SerialPrograms/Source/NintendoSwitch/Framework/NintendoSwitch_SingleSwitchProgramSession.cpp +++ b/SerialPrograms/Source/NintendoSwitch/Framework/NintendoSwitch_SingleSwitchProgramSession.cpp @@ -7,7 +7,9 @@ #include "Common/Cpp/Exceptions.h" #include "Common/Cpp/EarlyShutdown.h" #include "Common/Cpp/Concurrency/SpinPause.h" +#include "CommonFramework/ErrorReports/ErrorReports.h" #include "CommonFramework/GlobalSettingsPanel.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/Exceptions/ProgramFinishedException.h" #include "CommonFramework/Options/Environment/SleepSuppressOption.h" #include "CommonFramework/Notifications/ProgramInfo.h" @@ -211,6 +213,25 @@ void SingleSwitchProgramSession::internal_run_program(){ message = e.name(); } report_error(message); + }catch (OperationFailedExceptionWithScreenshot& e){ + logger().log("Program stopped with an exception!", COLOR_RED); + env.console.overlay().add_log("- Program Error -", COLOR_RED); + + std::string message = e.message(); + if (message.empty()){ + message = e.name(); + } + report_error(message); + send_program_fatal_error_notification(env, m_option.instance().NOTIFICATION_ERROR_FATAL, e.message(), *e.screenshot()); + PokemonAutomation::report_error( + &env.logger(), + env.program_info(), + "Recoverable: OperationFailedExceptionWithScreenshot", + {{"Message:", e.message()}}, + *e.screenshot(), + &e.video_stream()->history() + ); + }catch (ScreenshotException& e){ logger().log("Program stopped with an exception!", COLOR_RED); env.console.overlay().add_log("- Program Error -", COLOR_RED); diff --git a/SerialPrograms/cmake/SourceFiles.cmake b/SerialPrograms/cmake/SourceFiles.cmake index f6da07157c..faf77b84c1 100644 --- a/SerialPrograms/cmake/SourceFiles.cmake +++ b/SerialPrograms/cmake/SourceFiles.cmake @@ -398,6 +398,8 @@ file(GLOB LIBRARY_SOURCES Source/CommonFramework/ErrorReports/ProgramDumper_Windows.tpp Source/CommonFramework/Exceptions/FatalProgramException.h Source/CommonFramework/Exceptions/OperationFailedException.h + Source/CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.cpp + Source/CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h Source/CommonFramework/Exceptions/ProgramFinishedException.cpp Source/CommonFramework/Exceptions/ProgramFinishedException.h Source/CommonFramework/Exceptions/ScreenshotException.cpp From 291d076cad209221a0c068f03282ba1295a0202d Mon Sep 17 00:00:00 2001 From: jw098 Date: Wed, 26 Aug 2026 17:43:46 -0700 Subject: [PATCH 03/15] add ErrorReport to OperationFailedExceptionWithScreenshot --- Common/Cpp/Exceptions.h | 7 +++++++ .../OperationFailedExceptionWithScreenshot.cpp | 12 +++++++++--- .../OperationFailedExceptionWithScreenshot.h | 9 +++++++++ .../Exceptions/ScreenshotException.h | 4 ---- ...intendoSwitch_MultiSwitchProgramSession.cpp | 18 ++++++++++-------- ...ntendoSwitch_SingleSwitchProgramSession.cpp | 18 ++++++++++-------- 6 files changed, 45 insertions(+), 23 deletions(-) diff --git a/Common/Cpp/Exceptions.h b/Common/Cpp/Exceptions.h index 0c6bcb3f29..cacb5f5d47 100644 --- a/Common/Cpp/Exceptions.h +++ b/Common/Cpp/Exceptions.h @@ -14,6 +14,13 @@ namespace PokemonAutomation{ + +enum class ErrorReport{ + NO_ERROR_REPORT, + SEND_ERROR_REPORT, +}; + + template [[noreturn]] void throw_and_log(Logger& logger, Args&&... args){ ExceptionType exception(std::forward(args)...); diff --git a/SerialPrograms/Source/CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.cpp b/SerialPrograms/Source/CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.cpp index becfb53b66..f3e48050d6 100644 --- a/SerialPrograms/Source/CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.cpp +++ b/SerialPrograms/Source/CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.cpp @@ -21,10 +21,12 @@ namespace PokemonAutomation{ OperationFailedExceptionWithScreenshot::OperationFailedExceptionWithScreenshot( + ErrorReport error_report, std::string message, VideoStream& stream ) - : m_message(std::move(message)) + : m_send_error_report(error_report) + , m_message(std::move(message)) , m_stream(&stream) , m_screenshot(stream.video().snapshot().frame) { @@ -33,20 +35,24 @@ OperationFailedExceptionWithScreenshot::OperationFailedExceptionWithScreenshot( } } OperationFailedExceptionWithScreenshot::OperationFailedExceptionWithScreenshot( + ErrorReport error_report, std::string message, VideoStream* stream, ImageRGB32 screenshot ) - : m_message(std::move(message)) + : m_send_error_report(error_report) + , m_message(std::move(message)) , m_stream(stream) , m_screenshot(std::make_shared(std::move(screenshot))) {} OperationFailedExceptionWithScreenshot::OperationFailedExceptionWithScreenshot( + ErrorReport error_report, std::string message, VideoStream* stream, std::shared_ptr screenshot ) - : m_message(std::move(message)) + : m_send_error_report(error_report) + , m_message(std::move(message)) , m_stream(stream) , m_screenshot(std::move(screenshot)) {} diff --git a/SerialPrograms/Source/CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h b/SerialPrograms/Source/CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h index 1ccd5a4c5f..b84afec878 100644 --- a/SerialPrograms/Source/CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h +++ b/SerialPrograms/Source/CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h @@ -26,6 +26,7 @@ class ImageRGB32; class OperationFailedExceptionWithScreenshot : public Exception{ public: OperationFailedExceptionWithScreenshot( + ErrorReport error_report, std::string message, VideoStream& stream ); @@ -34,11 +35,13 @@ class OperationFailedExceptionWithScreenshot : public Exception{ // Use the provided screenshot instead of taking one with the console. // Store the console information (if provided) for stream history if requested later. OperationFailedExceptionWithScreenshot( + ErrorReport error_report, std::string message, VideoStream* stream, ImageRGB32 screenshot ); OperationFailedExceptionWithScreenshot( + ErrorReport error_report, std::string message, VideoStream* stream, std::shared_ptr screenshot @@ -47,22 +50,26 @@ class OperationFailedExceptionWithScreenshot : public Exception{ // This is the most common use case. Throw and log exception. // Include console information for screenshot and stream history. [[noreturn]] static void fire( + ErrorReport error_report, std::string message, VideoStream& stream ){ throw_and_log( stream.logger(), + error_report, std::move(message), stream ); } [[noreturn]] static void fire( + ErrorReport error_report, std::string message, VideoStream& stream, std::shared_ptr screenshot ){ throw_and_log( stream.logger(), + error_report, std::move(message), &stream, std::move(screenshot) @@ -73,8 +80,10 @@ class OperationFailedExceptionWithScreenshot : public Exception{ ImageViewRGB32 screenshot_view() const; std::shared_ptr screenshot() const; VideoStream* video_stream() const; + ErrorReport error_report_mode() const { return m_send_error_report; }; public: + ErrorReport m_send_error_report; std::string m_message; VideoStream* m_stream = nullptr; std::shared_ptr m_screenshot; diff --git a/SerialPrograms/Source/CommonFramework/Exceptions/ScreenshotException.h b/SerialPrograms/Source/CommonFramework/Exceptions/ScreenshotException.h index b8edc09fa3..26a5f1290d 100644 --- a/SerialPrograms/Source/CommonFramework/Exceptions/ScreenshotException.h +++ b/SerialPrograms/Source/CommonFramework/Exceptions/ScreenshotException.h @@ -20,10 +20,6 @@ struct ProgramInfo; class ProgramEnvironment; -enum class ErrorReport{ - NO_ERROR_REPORT, - SEND_ERROR_REPORT, -}; // Base class for program exception holding a screenshot. diff --git a/SerialPrograms/Source/NintendoSwitch/Framework/NintendoSwitch_MultiSwitchProgramSession.cpp b/SerialPrograms/Source/NintendoSwitch/Framework/NintendoSwitch_MultiSwitchProgramSession.cpp index ab087b621a..c170e43338 100644 --- a/SerialPrograms/Source/NintendoSwitch/Framework/NintendoSwitch_MultiSwitchProgramSession.cpp +++ b/SerialPrograms/Source/NintendoSwitch/Framework/NintendoSwitch_MultiSwitchProgramSession.cpp @@ -259,14 +259,16 @@ void MultiSwitchProgramSession::internal_run_program(){ } report_error(message); send_program_fatal_error_notification(env, m_option.instance().NOTIFICATION_ERROR_FATAL, e.message(), *e.screenshot()); - PokemonAutomation::report_error( - &env.logger(), - env.program_info(), - "Recoverable: OperationFailedExceptionWithScreenshot", - {{"Message:", e.message()}}, - *e.screenshot(), - &e.video_stream()->history() - ); + if (e.error_report_mode() == ErrorReport::SEND_ERROR_REPORT){ + PokemonAutomation::report_error( + &env.logger(), + env.program_info(), + "Recoverable: OperationFailedExceptionWithScreenshot", + {{"Message:", e.message()}}, + *e.screenshot(), + &e.video_stream()->history() + ); + } }catch (ScreenshotException& e){ logger().log("Program stopped with an exception!", COLOR_RED); diff --git a/SerialPrograms/Source/NintendoSwitch/Framework/NintendoSwitch_SingleSwitchProgramSession.cpp b/SerialPrograms/Source/NintendoSwitch/Framework/NintendoSwitch_SingleSwitchProgramSession.cpp index 9f2b84dccf..a25be43ea4 100644 --- a/SerialPrograms/Source/NintendoSwitch/Framework/NintendoSwitch_SingleSwitchProgramSession.cpp +++ b/SerialPrograms/Source/NintendoSwitch/Framework/NintendoSwitch_SingleSwitchProgramSession.cpp @@ -223,14 +223,16 @@ void SingleSwitchProgramSession::internal_run_program(){ } report_error(message); send_program_fatal_error_notification(env, m_option.instance().NOTIFICATION_ERROR_FATAL, e.message(), *e.screenshot()); - PokemonAutomation::report_error( - &env.logger(), - env.program_info(), - "Recoverable: OperationFailedExceptionWithScreenshot", - {{"Message:", e.message()}}, - *e.screenshot(), - &e.video_stream()->history() - ); + if (e.error_report_mode() == ErrorReport::SEND_ERROR_REPORT){ + PokemonAutomation::report_error( + &env.logger(), + env.program_info(), + "Recoverable: OperationFailedExceptionWithScreenshot", + {{"Message:", e.message()}}, + *e.screenshot(), + &e.video_stream()->history() + ); + } }catch (ScreenshotException& e){ logger().log("Program stopped with an exception!", COLOR_RED); From 77318146515d388009890adcba23cc852d54e436 Mon Sep 17 00:00:00 2001 From: jw098 Date: Wed, 26 Aug 2026 22:05:47 -0700 Subject: [PATCH 04/15] OperationFailedExceptionWithScreenshot replaces the old OperationFailedException. OperationFailedException now directly inherits exception. --- .../Exceptions/OperationFailedException.h | 50 +++++--------- ...OperationFailedExceptionWithScreenshot.cpp | 9 +-- .../OperationFailedExceptionWithScreenshot.h | 8 +-- .../Exceptions/UnexpectedBattleException.h | 6 +- .../CommonFramework/Tools/ErrorDumper.cpp | 4 +- .../CommonFramework/Tools/ErrorDumper.h | 2 +- .../Source/CommonTools/MultiConsoleErrors.cpp | 4 +- .../Framework/ComputerProgramSession.cpp | 17 ++++- .../Source/ML/Inference/ML_YOLONavigation.cpp | 4 +- .../DevPrograms/TestProgramComputer.cpp | 6 +- .../DevPrograms/TestProgramSwitch.cpp | 6 +- .../DateManip/NintendoSwitch_DateManip.cpp | 12 ++-- .../NintendoSwitch_DateManip_24h.cpp | 6 +- .../DateManip/NintendoSwitch_DateManip_US.cpp | 4 +- .../NintendoSwitch1_HomeToDateTime.cpp | 6 +- .../NintendoSwitch2_HomeToDateTime.cpp | 8 +-- .../Programs/NintendoSwitch_GameEntry.cpp | 8 +-- .../Eggs/PokemonBDSP_EggAutonomous.cpp | 19 ++++-- .../Eggs/PokemonBDSP_EggAutonomousState.cpp | 6 +- .../Programs/Eggs/PokemonBDSP_EggFeedback.cpp | 10 +-- .../Farming/PokemonBDSP_DoublesLeveling.cpp | 4 +- .../Farming/PokemonBDSP_GiftBerryReset.cpp | 8 +-- .../PokemonBDSP_MoneyFarmerRoute210.cpp | 8 +-- .../PokemonBDSP_MoneyFarmerRoute212.cpp | 6 +- .../PokemonBDSP_ActivateMenuGlitch-1.1.2.cpp | 8 +-- .../PokemonBDSP_ActivateMenuGlitch-1.1.3.cpp | 4 +- .../PokemonBDSP_CloneItemsBoxCopy2.cpp | 4 +- .../Programs/PokemonBDSP_BasicCatcher.cpp | 6 +- .../Programs/PokemonBDSP_EncounterHandler.cpp | 6 +- .../Programs/PokemonBDSP_GameNavigation.cpp | 8 +-- .../Programs/PokemonBDSP_GlobalRoomHeal.cpp | 4 +- .../Programs/PokemonBDSP_OverworldTrigger.cpp | 4 +- .../PokemonBDSP_ShinyHunt-Overworld.cpp | 17 ++++- .../ShinyHunting/PokemonBDSP_StarterReset.cpp | 4 +- .../PokemonFRLG/PokemonFRLG_Navigation.cpp | 40 +++++------ .../Farming/PokemonFRLG_EvTrainer.cpp | 14 ++-- .../PokemonFRLG_HeldItemFarmer-SafariZone.cpp | 4 +- .../Farming/PokemonFRLG_ItemDuplication.cpp | 12 ++-- .../Farming/PokemonFRLG_PickupFarmer.cpp | 10 +-- .../PokemonFRLG_StartMenuNavigation.cpp | 6 +- .../PokemonFRLG_BlindNavigation.cpp | 62 ++++++++--------- .../RngManipulation/PokemonFRLG_EggRng.cpp | 12 ++-- .../RngManipulation/PokemonFRLG_GiftRng.cpp | 4 +- .../RngManipulation/PokemonFRLG_HardReset.cpp | 10 +-- .../PokemonFRLG_RngLoopRoutines.cpp | 4 +- .../PokemonFRLG_RngNavigation.cpp | 26 +++---- .../PokemonFRLG_RoamingLegendaryRng.cpp | 6 +- .../RngManipulation/PokemonFRLG_SidHelper.cpp | 8 +-- .../PokemonFRLG_StarterRng.cpp | 4 +- .../RngManipulation/PokemonFRLG_WildRng.cpp | 8 +-- .../ShinyHunting/PokemonFRLG_GiftReset.cpp | 10 +-- .../PokemonFRLG_LegendaryReset.cpp | 4 +- .../PokemonFRLG_LegendaryRunAway.cpp | 12 ++-- .../PokemonFRLG_PrizeCornerReset.cpp | 4 +- .../PokemonFRLG_ShinyHunt-Fishing.cpp | 4 +- .../Programs/PokemonHome_BoxNavigation.cpp | 4 +- .../Programs/PokemonHome_BoxSorter.cpp | 6 +- .../PokemonHome_BoxSorterLivingDex.cpp | 6 +- .../Farming/PokemonLA_IngoBattleGrinder.cpp | 10 +-- .../Farming/PokemonLA_IngoMoveGrinder.cpp | 10 +-- .../Farming/PokemonLA_LeapGrinder.cpp | 19 ++++-- .../Farming/PokemonLA_MagikarpMoveGrinder.cpp | 6 +- .../PokemonLA_NuggetFarmerHighlands.cpp | 17 ++++- .../Farming/PokemonLA_TenacityCandyFarmer.cpp | 8 +-- .../General/PokemonLA_DistortionWaiter.cpp | 4 +- .../General/PokemonLA_MMORoutines.cpp | 10 +-- .../General/PokemonLA_OutbreakFinder.cpp | 4 +- .../General/PokemonLA_RamanasIslandCombee.cpp | 21 ++++-- .../General/PokemonLA_SkipToFullMoon.cpp | 4 +- ...monLA_GeneratePokemonImageTrainingData.cpp | 4 +- .../Programs/PokemonLA_BattleRoutines.cpp | 10 +-- .../Programs/PokemonLA_FlagNavigationAir.cpp | 12 ++-- .../PokemonLA/Programs/PokemonLA_GameSave.cpp | 6 +- .../Programs/PokemonLA_MountChange.cpp | 6 +- .../Programs/PokemonLA_RegionNavigation.cpp | 34 +++++----- .../Programs/PokemonLA_TimeOfDayChange.cpp | 6 +- .../ShinyHunting/PokemonLA_AutoMultiSpawn.cpp | 16 ++--- .../ShinyHunting/PokemonLA_BurmyFinder.cpp | 21 ++++-- .../ShinyHunting/PokemonLA_CrobatFinder.cpp | 19 ++++-- .../ShinyHunting/PokemonLA_FroslassFinder.cpp | 17 ++++- .../ShinyHunting/PokemonLA_GalladeFinder.cpp | 17 ++++- .../PokemonLA_PostMMOSpawnReset.cpp | 17 ++++- .../PokemonLA_ShinyHunt-CustomPath.cpp | 17 ++++- .../PokemonLA_ShinyHunt-FlagPin.cpp | 17 ++++- .../PokemonLA_ShinyHunt-LakeTrio.cpp | 4 +- .../ShinyHunting/PokemonLA_UnownFinder.cpp | 17 ++++- .../Programs/PokemonLGPE_GameEntry.cpp | 4 +- .../ShinyHunting/PokemonLGPE_AlolanTrade.cpp | 6 +- .../PokemonLGPE_FossilRevival.cpp | 6 +- .../ShinyHunting/PokemonLGPE_GiftReset.cpp | 4 +- .../PokemonLGPE_LegendaryReset.cpp | 27 +++++--- .../Farming/PokemonLZA_DonutMaker.cpp | 18 ++--- .../Farming/PokemonLZA_FriendshipFarmer.cpp | 18 ++--- .../PokemonLZA_HyperspaceRewardReset.cpp | 4 +- .../Farming/PokemonLZA_InPlaceCatcher.cpp | 4 +- .../PokemonLZA_JacintheInfiniteFarmer.cpp | 8 +-- .../Farming/PokemonLZA_MegaShardFarmer.cpp | 4 +- .../Farming/PokemonLZA_RestaurantFarmer.cpp | 6 +- .../Farming/PokemonLZA_WigglytuffFarmer.cpp | 6 +- .../NonShinyHunting/PokemonLZA_StatsReset.cpp | 10 +-- .../Programs/PokemonLZA_BasicNavigation.cpp | 20 +++--- .../Programs/PokemonLZA_BoxSorter.cpp | 4 +- .../Programs/PokemonLZA_ClothingBuyer.cpp | 4 +- .../Programs/PokemonLZA_DonutBerrySession.cpp | 8 +-- .../Programs/PokemonLZA_DonutBerrySession.h | 6 +- .../PokemonLZA_FastTravelNavigation.cpp | 12 ++-- .../PokemonLZA_HyperspaceNavigation.cpp | 6 +- .../Programs/PokemonLZA_MenuNavigation.cpp | 14 ++-- .../Programs/PokemonLZA_StallBuyer.cpp | 6 +- .../ShinyHunting/PokemonLZA_AutoFossil.cpp | 6 +- .../ShinyHunting/PokemonLZA_BeldumHunter.cpp | 19 ++++-- .../ShinyHunting/PokemonLZA_SewerHunter.cpp | 6 +- .../PokemonLZA_ShinyHunt_BenchSit.cpp | 4 +- .../PokemonLZA_ShinyHunt_FlySpotReset.cpp | 10 +-- .../PokemonLZA_ShinyHunt_HyperspaceHunter.cpp | 8 +-- ...kemonLZA_ShinyHunt_HyperspaceLegendary.cpp | 6 +- .../ShinyHunting/PokemonLZA_ShuttleRun.cpp | 8 +-- .../ShinyHunting/PokemonLZA_WildZoneCafe.cpp | 12 ++-- .../PokemonLZA_WildZoneEntrance.cpp | 14 ++-- .../PokemonPokopia_CloudIslandReset.cpp | 14 ++-- .../Programs/PokemonPokopia_DailyFarmer.cpp | 4 +- .../Programs/PokemonPokopia_PCNavigation.cpp | 32 ++++----- .../PokemonRSE/PokemonRSE_Navigation.cpp | 12 ++-- .../PokemonRSE_AudioStarterReset.cpp | 12 ++-- .../ShinyHunting/PokemonRSE_GiftReset.cpp | 10 +-- .../PokemonRSE_LegendaryRunAway-Emerald.cpp | 26 +++---- .../PokemonRSE_ShinyHunt-Deoxys.cpp | 6 +- .../ShinyHunting/PokemonRSE_ShinyHunt-Mew.cpp | 8 +-- .../ShinyHunting/PokemonRSE_StarterReset.cpp | 6 +- .../Battles/PokemonSV_NormalBattleMenus.cpp | 4 +- .../PokemonSV_ItemPrinterJobsDetector.cpp | 4 +- .../PokemonSV_ItemPrinterMaterialDetector.cpp | 8 +-- .../PokemonSV_AreaZeroSkyDetector.cpp | 4 +- .../Overworld/PokemonSV_DirectionDetector.cpp | 4 +- .../Inference/PokemonSV_MainMenuDetector.cpp | 4 +- .../PokemonSV_ZeroGateWarpPromptDetector.cpp | 6 +- .../AutoStory/PokemonSV_AutoStory.cpp | 4 +- .../AutoStory/PokemonSV_AutoStoryTools.cpp | 68 +++++++++---------- .../PokemonSV_AutoStory_Segment_01.cpp | 4 +- .../PokemonSV_AutoStory_Segment_04.cpp | 4 +- .../PokemonSV_AutoStory_Segment_10.cpp | 4 +- .../PokemonSV_AutoStory_Segment_12.cpp | 4 +- .../PokemonSV_AutoStory_Segment_13.cpp | 4 +- .../PokemonSV_AutoStory_Segment_14.cpp | 5 +- .../PokemonSV_AutoStory_Segment_15.cpp | 4 +- .../PokemonSV_AutoStory_Segment_18.cpp | 4 +- .../PokemonSV_AutoStory_Segment_20.cpp | 4 +- .../PokemonSV_AutoStory_Segment_21.cpp | 4 +- .../PokemonSV_AutoStory_Segment_22.cpp | 12 ++-- .../PokemonSV_AutoStory_Segment_25.cpp | 4 +- .../PokemonSV_AutoStory_Segment_26.cpp | 4 +- .../PokemonSV_AutoStory_Segment_28.cpp | 4 +- .../PokemonSV_AutoStory_Segment_30.cpp | 4 +- .../PokemonSV_AutoStory_Segment_31.cpp | 4 +- .../PokemonSV_AutoStory_Segment_33.cpp | 14 ++-- .../PokemonSV_AutoStory_Segment_34.cpp | 4 +- .../PokemonSV_AutoStory_Segment_40.cpp | 8 +-- .../AutoStory/PokemonSV_MenuOption.cpp | 12 ++-- .../PokemonSV_OliveActionFailedException.h | 6 +- .../Battles/PokemonSV_BasicCatcher.cpp | 6 +- .../Programs/Battles/PokemonSV_Battles.cpp | 22 +++--- .../Battles/PokemonSV_SinglesBattler.cpp | 8 +-- .../Programs/Boxes/PokemonSV_BoxRoutines.cpp | 36 ++++++++-- .../Programs/Eggs/PokemonSV_EggAutonomous.cpp | 8 +-- .../Programs/Eggs/PokemonSV_EggRoutines.cpp | 4 +- .../Farming/PokemonSV_AuctionFarmer.cpp | 27 +++++--- .../Farming/PokemonSV_BlueberryCatchPhoto.cpp | 24 +++---- .../Farming/PokemonSV_BlueberryQuests.cpp | 16 ++--- .../Farming/PokemonSV_ClaimMysteryGift.cpp | 10 +-- .../Farming/PokemonSV_FlyingTrialFarmer.cpp | 6 +- .../PokemonSV_GimmighoulChestFarmer.cpp | 6 +- .../Farming/PokemonSV_MaterialFarmerTools.cpp | 31 ++++++--- .../Farming/PokemonSV_TournamentFarmer.cpp | 18 ++--- .../Farming/PokemonSV_TournamentFarmer2.cpp | 8 +-- .../General/PokemonSV_ClothingBuyer.cpp | 6 +- .../General/PokemonSV_SizeChecker.cpp | 12 ++-- .../Programs/General/PokemonSV_StatsReset.cpp | 20 +++--- .../PokemonSV_StatsResetEventBattle.cpp | 10 +-- .../Glitches/PokemonSV_CloneItems-1.0.1.cpp | 31 +++++++-- .../Glitches/PokemonSV_RideCloner-1.0.1.cpp | 17 ++++- .../Glitches/PokemonSV_WildItemFarmer.cpp | 14 ++-- .../ItemPrinter/PokemonSV_AutoItemPrinter.cpp | 4 +- .../ItemPrinter/PokemonSV_ItemPrinterRNG.cpp | 10 +-- .../PokemonSV_ItemPrinterTools.cpp | 6 +- .../PokemonSV/Programs/PokemonSV_AreaZero.cpp | 22 +++--- .../Programs/PokemonSV_ConnectToInternet.cpp | 14 ++-- .../Programs/PokemonSV_GameEntry.cpp | 8 +-- .../Programs/PokemonSV_MenuNavigation.cpp | 56 +++++++-------- .../PokemonSV/Programs/PokemonSV_SaveGame.cpp | 8 +-- .../PokemonSV/Programs/PokemonSV_Terarium.cpp | 6 +- .../Programs/PokemonSV_WorldNavigation.cpp | 46 ++++++------- .../PokemonSV_IngredientSession.cpp | 14 ++-- .../Sandwiches/PokemonSV_SandwichRoutines.cpp | 12 ++-- .../ShinyHunting/PokemonSV_LetsGoTools.cpp | 2 +- .../PokemonSV_ShinyHunt-AreaZeroPlatform.cpp | 17 ++++- .../PokemonSV_ShinyHunt-Scatterbug.cpp | 19 ++++-- .../Programs/TeraRaids/PokemonSV_AutoHost.cpp | 49 ++++++++++--- .../TeraRaids/PokemonSV_TeraBattler.cpp | 4 +- .../TeraRaids/PokemonSV_TeraMultiFarmer.cpp | 19 ++++-- .../TeraRaids/PokemonSV_TeraRoutines.cpp | 10 +-- ...PokemonSwSh_MaxLair_CatchScreenTracker.cpp | 10 +-- .../PokemonSwSh_MaxLair_Run_Battle.cpp | 4 +- .../PokemonSwSh_MaxLair_Run_EnterLobby.cpp | 6 +- .../PokemonSwSh_MaxLair_Run_Entrance.cpp | 6 +- .../EggPrograms/PokemonSwSh_EggAutonomous.cpp | 59 +++++++++------- .../PokemonSwSh_StatsReset-Moltres.cpp | 4 +- .../Programs/PokemonSwSh_BoxHelpers.cpp | 6 +- .../Programs/PokemonSwSh_EncounterHandler.cpp | 8 +-- .../Programs/PokemonSwSh_MenuNavigation.cpp | 12 ++-- .../PokemonSwSh_FriendSearchDisconnect.cpp | 4 +- .../Programs/RNG/PokemonSwSh_BasicRNG.cpp | 8 +-- .../RNG/PokemonSwSh_CramomaticRNG.cpp | 12 ++-- .../RNG/PokemonSwSh_DailyHighlightRNG.cpp | 16 ++--- 213 files changed, 1347 insertions(+), 1044 deletions(-) diff --git a/SerialPrograms/Source/CommonFramework/Exceptions/OperationFailedException.h b/SerialPrograms/Source/CommonFramework/Exceptions/OperationFailedException.h index 8bc086e2ab..d1d3c7dc71 100644 --- a/SerialPrograms/Source/CommonFramework/Exceptions/OperationFailedException.h +++ b/SerialPrograms/Source/CommonFramework/Exceptions/OperationFailedException.h @@ -7,49 +7,31 @@ #ifndef PokemonAutomation_OperationFailedException_H #define PokemonAutomation_OperationFailedException_H -#include -#include "CommonFramework/Tools/VideoStream.h" -#include "ScreenshotException.h" +#include "Common/Cpp/Exceptions.h" namespace PokemonAutomation{ // Thrown by subroutines if they fail for an in-game reason. // These include recoverable errors which can be consumed by the program. -class OperationFailedException : public ScreenshotException{ +class OperationFailedException : public Exception{ public: - using ScreenshotException::ScreenshotException; - - // This is the most common use case. Throw and log exception. - // Include console information for screenshot and stream history. - [[noreturn]] static void fire( - ErrorReport error_report, - std::string message, - VideoStream& stream - ){ - throw_and_log( - stream.logger(), - error_report, - std::move(message), - stream - ); - } - [[noreturn]] static void fire( - ErrorReport error_report, - std::string message, - VideoStream& stream, - std::shared_ptr screenshot - ){ - throw_and_log( - stream.logger(), - error_report, - std::move(message), - &stream, - std::move(screenshot) - ); - } + OperationFailedException( + ErrorReport error_report_mode, + std::string message + ) + : m_error_report_mode(error_report_mode) + , m_message(std::move(message)) + {} + + ErrorReport error_report_mode() const { return m_error_report_mode; }; virtual const char* name() const override{ return "OperationFailedException"; } + virtual std::string message() const override{ return m_message; } + +private: + ErrorReport m_error_report_mode; + std::string m_message; }; diff --git a/SerialPrograms/Source/CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.cpp b/SerialPrograms/Source/CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.cpp index f3e48050d6..bff0fa553f 100644 --- a/SerialPrograms/Source/CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.cpp +++ b/SerialPrograms/Source/CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.cpp @@ -25,8 +25,7 @@ OperationFailedExceptionWithScreenshot::OperationFailedExceptionWithScreenshot( std::string message, VideoStream& stream ) - : m_send_error_report(error_report) - , m_message(std::move(message)) + : OperationFailedException(error_report, std::move(message)) , m_stream(&stream) , m_screenshot(stream.video().snapshot().frame) { @@ -40,8 +39,7 @@ OperationFailedExceptionWithScreenshot::OperationFailedExceptionWithScreenshot( VideoStream* stream, ImageRGB32 screenshot ) - : m_send_error_report(error_report) - , m_message(std::move(message)) + : OperationFailedException(error_report, std::move(message)) , m_stream(stream) , m_screenshot(std::make_shared(std::move(screenshot))) {} @@ -51,8 +49,7 @@ OperationFailedExceptionWithScreenshot::OperationFailedExceptionWithScreenshot( VideoStream* stream, std::shared_ptr screenshot ) - : m_send_error_report(error_report) - , m_message(std::move(message)) + : OperationFailedException(error_report, std::move(message)) , m_stream(stream) , m_screenshot(std::move(screenshot)) {} diff --git a/SerialPrograms/Source/CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h b/SerialPrograms/Source/CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h index b84afec878..f7ac248dd3 100644 --- a/SerialPrograms/Source/CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h +++ b/SerialPrograms/Source/CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h @@ -9,6 +9,7 @@ #include #include "CommonFramework/Tools/VideoStream.h" +#include "CommonFramework/Exceptions/OperationFailedException.h" #include "Common/Cpp/Exceptions.h" namespace PokemonAutomation{ @@ -23,7 +24,7 @@ class ImageRGB32; // Thrown by subroutines if they fail for an in-game reason. // These include recoverable errors which can be consumed by the program. -class OperationFailedExceptionWithScreenshot : public Exception{ +class OperationFailedExceptionWithScreenshot : public OperationFailedException{ public: OperationFailedExceptionWithScreenshot( ErrorReport error_report, @@ -80,11 +81,8 @@ class OperationFailedExceptionWithScreenshot : public Exception{ ImageViewRGB32 screenshot_view() const; std::shared_ptr screenshot() const; VideoStream* video_stream() const; - ErrorReport error_report_mode() const { return m_send_error_report; }; -public: - ErrorReport m_send_error_report; - std::string m_message; +private: VideoStream* m_stream = nullptr; std::shared_ptr m_screenshot; }; diff --git a/SerialPrograms/Source/CommonFramework/Exceptions/UnexpectedBattleException.h b/SerialPrograms/Source/CommonFramework/Exceptions/UnexpectedBattleException.h index 78441276c9..57e54e43f4 100644 --- a/SerialPrograms/Source/CommonFramework/Exceptions/UnexpectedBattleException.h +++ b/SerialPrograms/Source/CommonFramework/Exceptions/UnexpectedBattleException.h @@ -7,21 +7,21 @@ #ifndef PokemonAutomation_UnexpectedBattleException_H #define PokemonAutomation_UnexpectedBattleException_H -#include "OperationFailedException.h" +#include "OperationFailedExceptionWithScreenshot.h" namespace PokemonAutomation{ namespace NintendoSwitch{ // Thrown by subroutines if caught in an wild battle in-game unexpectedly. // These include recoverable errors which can be consumed by the program. -class UnexpectedBattleException : public OperationFailedException{ +class UnexpectedBattleException : public OperationFailedExceptionWithScreenshot{ public: UnexpectedBattleException( ErrorReport error_report, std::string message, VideoStream& stream ) - : OperationFailedException(error_report, std::move(message), stream) + : OperationFailedExceptionWithScreenshot(error_report, std::move(message), stream) {} virtual const char* name() const override{ return "UnexpectedBattleException"; } diff --git a/SerialPrograms/Source/CommonFramework/Tools/ErrorDumper.cpp b/SerialPrograms/Source/CommonFramework/Tools/ErrorDumper.cpp index c295827154..1bcc04dcf0 100644 --- a/SerialPrograms/Source/CommonFramework/Tools/ErrorDumper.cpp +++ b/SerialPrograms/Source/CommonFramework/Tools/ErrorDumper.cpp @@ -7,7 +7,7 @@ #include #include "Common/Cpp/PrettyPrint.h" #include "Common/Cpp/Concurrency/Mutex.h" -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/GlobalAutoPaths.h" #include "CommonFramework/ImageTypes/ImageViewRGB32.h" //#include "CommonFramework/Notifications/EventNotificationOption.h" @@ -72,7 +72,7 @@ void dump_image_and_throw_recoverable_exception( const std::string& error_message, const ImageViewRGB32& screenshot ){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, error_message, stream diff --git a/SerialPrograms/Source/CommonFramework/Tools/ErrorDumper.h b/SerialPrograms/Source/CommonFramework/Tools/ErrorDumper.h index 28c445ca41..9e2551518a 100644 --- a/SerialPrograms/Source/CommonFramework/Tools/ErrorDumper.h +++ b/SerialPrograms/Source/CommonFramework/Tools/ErrorDumper.h @@ -50,7 +50,7 @@ void dump_image( ); // Throw an OperationFailedException that will trigger error report creation. -// Check OperationFailedException::fire() for more details. +// Check OperationFailedExceptionWithScreenshot::fire() for more details. [[noreturn]] void dump_image_and_throw_recoverable_exception( const ProgramInfo& program_info, VideoStream& stream, diff --git a/SerialPrograms/Source/CommonTools/MultiConsoleErrors.cpp b/SerialPrograms/Source/CommonTools/MultiConsoleErrors.cpp index 393d08e1fe..9a07bc0a4c 100644 --- a/SerialPrograms/Source/CommonTools/MultiConsoleErrors.cpp +++ b/SerialPrograms/Source/CommonTools/MultiConsoleErrors.cpp @@ -4,7 +4,7 @@ * */ -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "MultiConsoleErrors.h" namespace PokemonAutomation{ @@ -17,7 +17,7 @@ void MultiConsoleErrorState::report_unrecoverable_error(VideoStream& stream, std if (m_unrecoverable_error.compare_exchange_strong(expected, true)){ m_message = msg; } - OperationFailedException::fire(ErrorReport::SEND_ERROR_REPORT, std::move(msg), stream); + OperationFailedExceptionWithScreenshot::fire(ErrorReport::SEND_ERROR_REPORT, std::move(msg), stream); } void MultiConsoleErrorState::check_unrecoverable_error(Logger& logger){ if (m_unrecoverable_error.load(std::memory_order_acquire)){ diff --git a/SerialPrograms/Source/ComputerPrograms/Framework/ComputerProgramSession.cpp b/SerialPrograms/Source/ComputerPrograms/Framework/ComputerProgramSession.cpp index 9f9e94b973..283875e0e6 100644 --- a/SerialPrograms/Source/ComputerPrograms/Framework/ComputerProgramSession.cpp +++ b/SerialPrograms/Source/ComputerPrograms/Framework/ComputerProgramSession.cpp @@ -6,8 +6,9 @@ #include "Common/Cpp/Exceptions.h" #include "Common/Cpp/CancellableScope.h" +#include "CommonFramework/ErrorReports/ErrorReports.h" #include "CommonFramework/Exceptions/ProgramFinishedException.h" -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/Notifications/ProgramInfo.h" #include "CommonFramework/Notifications/ProgramNotifications.h" #include "CommonFramework/Options/Environment/PerformanceOptions.h" @@ -120,14 +121,24 @@ void ComputerProgramSession::internal_run_program(){ logger().log("Program finished early!", COLOR_BLUE); e.send_notification(env, m_option.instance().NOTIFICATION_PROGRAM_FINISH); }catch (InvalidConnectionStateException&){ - }catch (OperationFailedException& e){ + }catch (OperationFailedExceptionWithScreenshot& e){ logger().log("Program stopped with an exception!", COLOR_RED); std::string message = e.message(); if (message.empty()){ message = e.name(); } report_error(message); - 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( + &env.logger(), + env.program_info(), + "Recoverable: OperationFailedExceptionWithScreenshot", + {{"Message:", e.message()}}, + *e.screenshot(), + &e.video_stream()->history() + ); + } }catch (Exception& e){ logger().log("Program stopped with an exception!", COLOR_RED); std::string message = e.message(); diff --git a/SerialPrograms/Source/ML/Inference/ML_YOLONavigation.cpp b/SerialPrograms/Source/ML/Inference/ML_YOLONavigation.cpp index b30e1930e9..1535e1d9f2 100644 --- a/SerialPrograms/Source/ML/Inference/ML_YOLONavigation.cpp +++ b/SerialPrograms/Source/ML/Inference/ML_YOLONavigation.cpp @@ -8,7 +8,7 @@ #include "Common/Cpp/PrettyPrint.h" #include "Common/Cpp/Color.h" #include "Common/Cpp/Exceptions.h" -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/Exceptions/UnexpectedBattleException.h" #include "CommonFramework/VideoPipeline/VideoFeed.h" #include "CommonFramework/VideoPipeline/VideoOverlayScopes.h" @@ -186,7 +186,7 @@ void move_camera_yolo( } if (!seen_object){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "move_camera_yolo(): Never detected the yolo object.", env.console diff --git a/SerialPrograms/Source/NintendoSwitch/DevPrograms/TestProgramComputer.cpp b/SerialPrograms/Source/NintendoSwitch/DevPrograms/TestProgramComputer.cpp index ed49b4f2b2..90c2d23761 100644 --- a/SerialPrograms/Source/NintendoSwitch/DevPrograms/TestProgramComputer.cpp +++ b/SerialPrograms/Source/NintendoSwitch/DevPrograms/TestProgramComputer.cpp @@ -25,7 +25,7 @@ #include "Common/Cpp/CpuId/CpuId.h" #include "CommonFramework/Globals.h" #include "CommonFramework/Exceptions/ProgramFinishedException.h" -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/ImageTools/ImageBoxes.h" #include "CommonTools/OCR/OCR_Routines.h" #include "PokemonSV/Inference/Tera/PokemonSV_TeraCodeReader.h" @@ -1002,8 +1002,8 @@ void TestProgramComputer::program(ProgramEnvironment& env, CancellableScope& sco OCR::read_number(env.logger(), filtered); #endif -// OperationFailedException::fire(env.logger(), "asdf"); -// OperationFailedException::fire(env.logger(), "asdf", std::make_shared("20221118-024539201323.jpg")); +// OperationFailedExceptionWithScreenshot::fire(env.logger(), "asdf"); +// OperationFailedExceptionWithScreenshot::fire(env.logger(), "asdf", std::make_shared("20221118-024539201323.jpg")); // throw ProgramFinishedException(); // throw FatalProgramException(env.logger(), "test"); diff --git a/SerialPrograms/Source/NintendoSwitch/DevPrograms/TestProgramSwitch.cpp b/SerialPrograms/Source/NintendoSwitch/DevPrograms/TestProgramSwitch.cpp index 64c3094af4..9d3f88eef1 100644 --- a/SerialPrograms/Source/NintendoSwitch/DevPrograms/TestProgramSwitch.cpp +++ b/SerialPrograms/Source/NintendoSwitch/DevPrograms/TestProgramSwitch.cpp @@ -13,7 +13,7 @@ #include "Common/Cpp/PrettyPrint.h" #include "Common/Cpp/Containers/FixedLimitVector.tpp" #include "Common/Cpp/Concurrency/BusyPeriodicRunner.h" -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonTools/Async/InferenceRoutines.h" #include "PokemonLA/Inference/PokemonLA_MountDetector.h" #include "Pokemon/Pokemon_Strings.h" @@ -396,7 +396,7 @@ void TestProgram::program(MultiSwitchProgramEnvironment& env, CancellableScope& -// OperationFailedException::fire(ErrorReport::SEND_ERROR_REPORT, "asdf", console); +// OperationFailedExceptionWithScreenshot::fire(ErrorReport::SEND_ERROR_REPORT, "asdf", console); // SinglesAIOption ai(false); @@ -432,7 +432,7 @@ void TestProgram::program(MultiSwitchProgramEnvironment& env, CancellableScope& // context->issue_gyro_accel_x(&scope, 1000ms, 1000ms, 0ms, 123); -// OperationFailedException::fire(ErrorReport::SEND_ERROR_REPORT, "test", console); +// OperationFailedExceptionWithScreenshot::fire(ErrorReport::SEND_ERROR_REPORT, "test", console); #if 0 auto snapshot = feed.snapshot(); diff --git a/SerialPrograms/Source/NintendoSwitch/Programs/DateManip/NintendoSwitch_DateManip.cpp b/SerialPrograms/Source/NintendoSwitch/Programs/DateManip/NintendoSwitch_DateManip.cpp index 418eb1e31b..4f3bce361a 100644 --- a/SerialPrograms/Source/NintendoSwitch/Programs/DateManip/NintendoSwitch_DateManip.cpp +++ b/SerialPrograms/Source/NintendoSwitch/Programs/DateManip/NintendoSwitch_DateManip.cpp @@ -4,7 +4,7 @@ * */ -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/ImageTypes/ImageRGB32.h" #include "CommonFramework/ImageTools/ImageStats.h" #include "CommonFramework/Tools/ErrorDumper.h" @@ -75,7 +75,7 @@ bool DateReader::detect(const ImageViewRGB32& screen){ std::pair DateReader::read_date(Logger& logger, std::shared_ptr screen){ if (!detect(*screen)){ - throw_and_log( + throw_and_log( logger, ErrorReport::SEND_ERROR_REPORT, "Not on date change screen.", nullptr, @@ -125,7 +125,7 @@ void DateReader::set_date( { auto snapshot = console.video().snapshot(); if (!detect(snapshot)){ - throw_and_log( + throw_and_log( console.logger(), ErrorReport::SEND_ERROR_REPORT, "Expected date change menu.", &console, @@ -138,7 +138,7 @@ void DateReader::set_date( auto snapshot = console.video().snapshot(); if (!detect(snapshot)){ - throw_and_log( + throw_and_log( console, ErrorReport::SEND_ERROR_REPORT, "Not on date change screen.", nullptr, @@ -225,7 +225,7 @@ void change_date( return; } default: - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Failed to set date", env.console @@ -251,7 +251,7 @@ void ensure_time_unsynced(SingleSwitchProgramEnvironment& env, ProControllerCont ); if (ret < 0){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Failed to enter Date Change window. Ensure that System Time is not synced to the internet.", env.console diff --git a/SerialPrograms/Source/NintendoSwitch/Programs/DateManip/NintendoSwitch_DateManip_24h.cpp b/SerialPrograms/Source/NintendoSwitch/Programs/DateManip/NintendoSwitch_DateManip_24h.cpp index 053c75b7c3..88a7f0aaf2 100644 --- a/SerialPrograms/Source/NintendoSwitch/Programs/DateManip/NintendoSwitch_DateManip_24h.cpp +++ b/SerialPrograms/Source/NintendoSwitch/Programs/DateManip/NintendoSwitch_DateManip_24h.cpp @@ -4,7 +4,7 @@ * */ -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/ErrorReports/ErrorReports.h" #include "CommonFramework/ImageTypes/ImageRGB32.h" #include "CommonFramework/VideoPipeline/VideoFeed.h" @@ -123,7 +123,7 @@ void DateReader_EU::set_date( move_horizontal(context, cursor_position, 5); } - throw_and_log( + throw_and_log( stream.logger(), ErrorReport::SEND_ERROR_REPORT, "Failed to set the hour after 10 attempts.", stream @@ -197,7 +197,7 @@ void DateReader_JP::set_date( move_horizontal(context, cursor_position, 5); } - throw_and_log( + throw_and_log( stream.logger(), ErrorReport::SEND_ERROR_REPORT, "Failed to set the hour after 10 attempts.", stream diff --git a/SerialPrograms/Source/NintendoSwitch/Programs/DateManip/NintendoSwitch_DateManip_US.cpp b/SerialPrograms/Source/NintendoSwitch/Programs/DateManip/NintendoSwitch_DateManip_US.cpp index 408f9afdf3..428f57f8f4 100644 --- a/SerialPrograms/Source/NintendoSwitch/Programs/DateManip/NintendoSwitch_DateManip_US.cpp +++ b/SerialPrograms/Source/NintendoSwitch/Programs/DateManip/NintendoSwitch_DateManip_US.cpp @@ -5,7 +5,7 @@ */ #include "Common/Cpp/Strings/Unicode.h" -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/ErrorReports/ErrorReports.h" #include "CommonFramework/ImageTypes/ImageRGB32.h" #include "CommonFramework/VideoPipeline/VideoFeed.h" @@ -165,7 +165,7 @@ void DateReader_US::set_date( move_horizontal(context, cursor_position, 6); } - throw_and_log( + throw_and_log( stream.logger(), ErrorReport::SEND_ERROR_REPORT, "Failed to set the hour after 10 attempts.", stream diff --git a/SerialPrograms/Source/NintendoSwitch/Programs/DateSpam/NintendoSwitch1_HomeToDateTime.cpp b/SerialPrograms/Source/NintendoSwitch/Programs/DateSpam/NintendoSwitch1_HomeToDateTime.cpp index f516cfa180..f8caf1e00e 100644 --- a/SerialPrograms/Source/NintendoSwitch/Programs/DateSpam/NintendoSwitch1_HomeToDateTime.cpp +++ b/SerialPrograms/Source/NintendoSwitch/Programs/DateSpam/NintendoSwitch1_HomeToDateTime.cpp @@ -5,7 +5,7 @@ */ #include "Common/Cpp/RecursiveThrottler.h" -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/ImageTools/ImageBoxes.h" //#include "CommonFramework/VideoPipeline/VideoFeed.h" //#include "CommonFramework/VideoPipeline/VideoOverlayScopes.h" @@ -359,7 +359,7 @@ void home_to_date_time_Switch1_wired_feedback( return; } - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "home_to_date_time(): Failed to reach Date and Time after several attempts.", stream @@ -491,7 +491,7 @@ void home_to_date_time_Switch1_wireless_feedback( return; } - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "home_to_date_time(): Failed to reach Date and Time after several attempts.", stream diff --git a/SerialPrograms/Source/NintendoSwitch/Programs/DateSpam/NintendoSwitch2_HomeToDateTime.cpp b/SerialPrograms/Source/NintendoSwitch/Programs/DateSpam/NintendoSwitch2_HomeToDateTime.cpp index 19528f78cc..e5970bb40f 100644 --- a/SerialPrograms/Source/NintendoSwitch/Programs/DateSpam/NintendoSwitch2_HomeToDateTime.cpp +++ b/SerialPrograms/Source/NintendoSwitch/Programs/DateSpam/NintendoSwitch2_HomeToDateTime.cpp @@ -5,7 +5,7 @@ */ #include "Common/Cpp/RecursiveThrottler.h" -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/VideoPipeline/VideoFeed.h" #include "CommonFramework/VideoPipeline/VideoOverlayScopes.h" #include "NintendoSwitch/Commands/NintendoSwitch_Commands_PushButtons.h" @@ -58,7 +58,7 @@ ConsoleType settings_detect_console_type( console.state().set_console_type(console, ConsoleType::Switch2_FW20_JapanLocked); break; default: - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::NO_ERROR_REPORT, "Unable to detect if this Switch 2 model is international or Japan-locked.", console, std::move(snapshot) @@ -250,7 +250,7 @@ void home_to_date_time_Switch2_procon_feedback( go_home(console, context); } } - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Unable to navigate to date/time after 5 attempts.", console, console.video().snapshot_latest_blocking() @@ -276,7 +276,7 @@ void home_to_date_time_Switch2_joycon_feedback( go_home(console, context); } } - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Unable to navigate to date/time after 5 attempts.", console, console.video().snapshot_latest_blocking() diff --git a/SerialPrograms/Source/NintendoSwitch/Programs/NintendoSwitch_GameEntry.cpp b/SerialPrograms/Source/NintendoSwitch/Programs/NintendoSwitch_GameEntry.cpp index c2f0a840a5..308259cae8 100644 --- a/SerialPrograms/Source/NintendoSwitch/Programs/NintendoSwitch_GameEntry.cpp +++ b/SerialPrograms/Source/NintendoSwitch/Programs/NintendoSwitch_GameEntry.cpp @@ -5,7 +5,7 @@ */ #include "Common/Cpp/Exceptions.h" -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/VideoPipeline/VideoFeed.h" #include "CommonFramework/VideoPipeline/VideoOverlayScopes.h" #include "CommonFramework/ImageTools/ImageBoxes.h" @@ -163,7 +163,7 @@ void ensure_at_home(ConsoleHandle& console, ControllerContext& context, size_t r console.log("Unable to detect Home. Pressing Home button...", COLOR_RED); pbf_press_button(context, BUTTON_HOME, 160ms, 160ms); } - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Unable to find Switch Home", console @@ -533,7 +533,7 @@ void start_game_from_home_with_inference( if (ret == 0){ console.log("Detected Home screen."); }else{ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "start_game_from_home_with_inference(): Failed to detect Home screen after 10 seconds.", console @@ -628,7 +628,7 @@ void start_game_from_home_with_inference( } if (ret < 0){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "start_game_from_home_with_inference(): Failed to start game after multiple attempts.", console diff --git a/SerialPrograms/Source/PokemonBDSP/Programs/Eggs/PokemonBDSP_EggAutonomous.cpp b/SerialPrograms/Source/PokemonBDSP/Programs/Eggs/PokemonBDSP_EggAutonomous.cpp index 870ff11ff1..f0f56c2629 100644 --- a/SerialPrograms/Source/PokemonBDSP/Programs/Eggs/PokemonBDSP_EggAutonomous.cpp +++ b/SerialPrograms/Source/PokemonBDSP/Programs/Eggs/PokemonBDSP_EggAutonomous.cpp @@ -5,7 +5,8 @@ */ #include "Common/Compiler.h" -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/ErrorReports/ErrorReports.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/Notifications/ProgramNotifications.h" #include "NintendoSwitch/NintendoSwitch_Settings.h" #include "NintendoSwitch/Commands/NintendoSwitch_Commands_PushButtons.h" @@ -218,16 +219,26 @@ void EggAutonomous::program(SingleSwitchProgramEnvironment& env, ProControllerCo break; } consecutive_failures = 0; - }catch (OperationFailedException& e){ + }catch (OperationFailedExceptionWithScreenshot& e){ // If there is no auto save, then we shouldn't reset to game to lose previous progress. if (AUTO_SAVING == AutoSave::NoAutoSave){ throw; } - e.send_notification(env, NOTIFICATION_ERROR_RECOVERABLE); + send_program_recoverable_error_notification(env, NOTIFICATION_ERROR_RECOVERABLE, e.message(), *e.screenshot()); + if (e.error_report_mode() == ErrorReport::SEND_ERROR_REPORT){ + PokemonAutomation::report_error( + &env.logger(), + env.program_info(), + "Recoverable: OperationFailedExceptionWithScreenshot", + {{"Message:", e.message()}}, + *e.screenshot(), + &e.video_stream()->history() + ); + } consecutive_failures++; if (consecutive_failures >= 3){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Failed 3 batches in the row.", env.console diff --git a/SerialPrograms/Source/PokemonBDSP/Programs/Eggs/PokemonBDSP_EggAutonomousState.cpp b/SerialPrograms/Source/PokemonBDSP/Programs/Eggs/PokemonBDSP_EggAutonomousState.cpp index 4282231388..3710b94758 100644 --- a/SerialPrograms/Source/PokemonBDSP/Programs/Eggs/PokemonBDSP_EggAutonomousState.cpp +++ b/SerialPrograms/Source/PokemonBDSP/Programs/Eggs/PokemonBDSP_EggAutonomousState.cpp @@ -5,7 +5,7 @@ */ #include -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/ImageTools/ImageStats.h" #include "CommonFramework/VideoPipeline/VideoFeed.h" #include "CommonFramework/Tools/ErrorDumper.h" @@ -136,7 +136,7 @@ void EggAutonomousState::set(const EggAutonomousState& state){ void EggAutonomousState::process_error(const std::string& name, const char* message){ m_stats.m_errors++; - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, message, m_stream @@ -404,7 +404,7 @@ void EggAutonomousState::hatch_egg(){ ); if (ret < 0){ process_error("NoHatchEnd", "End of hatch not detected after 30 seconds."); -// OperationFailedException::fire(m_console, "End of hatch not detected after 30 seconds."); +// OperationFailedExceptionWithScreenshot::fire(m_console, "End of hatch not detected after 30 seconds."); } m_stream.log("Egg finished hatching."); m_stats.m_hatched++; diff --git a/SerialPrograms/Source/PokemonBDSP/Programs/Eggs/PokemonBDSP_EggFeedback.cpp b/SerialPrograms/Source/PokemonBDSP/Programs/Eggs/PokemonBDSP_EggFeedback.cpp index 975a6ab089..0e36602082 100644 --- a/SerialPrograms/Source/PokemonBDSP/Programs/Eggs/PokemonBDSP_EggFeedback.cpp +++ b/SerialPrograms/Source/PokemonBDSP/Programs/Eggs/PokemonBDSP_EggFeedback.cpp @@ -4,7 +4,7 @@ * */ -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/VideoPipeline/VideoFeed.h" #include "CommonTools/Async/InferenceRoutines.h" #include "CommonTools/VisualDetectors/FrozenImageDetector.h" @@ -47,13 +47,13 @@ void hatch_egg(VideoStream& stream, ProControllerContext& context){ stream.log("Egg is hatching!"); break; case 1: - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Frozen screen detected!", stream ); default: - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "No hatch detected after 8 minutes of spinning.", stream @@ -75,7 +75,7 @@ void hatch_egg(VideoStream& stream, ProControllerContext& context){ {{dialog}} ); if (ret < 0){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "End of hatch not detected after 30 seconds.", stream @@ -149,7 +149,7 @@ void release(VideoStream& stream, ProControllerContext& context){ } pbf_press_button(context, BUTTON_ZL, 160ms, 840ms); } - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Unexpected dialogs when releasing.", stream diff --git a/SerialPrograms/Source/PokemonBDSP/Programs/Farming/PokemonBDSP_DoublesLeveling.cpp b/SerialPrograms/Source/PokemonBDSP/Programs/Farming/PokemonBDSP_DoublesLeveling.cpp index e1c84ff07a..7c8ca78bd6 100644 --- a/SerialPrograms/Source/PokemonBDSP/Programs/Farming/PokemonBDSP_DoublesLeveling.cpp +++ b/SerialPrograms/Source/PokemonBDSP/Programs/Farming/PokemonBDSP_DoublesLeveling.cpp @@ -4,7 +4,7 @@ * */ -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/Notifications/ProgramNotifications.h" #include "CommonTools/Async/InferenceRoutines.h" #include "CommonTools/VisualDetectors/FrozenImageDetector.h" @@ -145,7 +145,7 @@ bool DoublesLeveling::battle(SingleSwitchProgramEnvironment& env, ProControllerC } } - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "No progress detected after 5 battle menus. Are you out of PP?", env.console diff --git a/SerialPrograms/Source/PokemonBDSP/Programs/Farming/PokemonBDSP_GiftBerryReset.cpp b/SerialPrograms/Source/PokemonBDSP/Programs/Farming/PokemonBDSP_GiftBerryReset.cpp index 11c87b8d28..832276bc3f 100644 --- a/SerialPrograms/Source/PokemonBDSP/Programs/Farming/PokemonBDSP_GiftBerryReset.cpp +++ b/SerialPrograms/Source/PokemonBDSP/Programs/Farming/PokemonBDSP_GiftBerryReset.cpp @@ -6,7 +6,7 @@ #include #include "CommonFramework/Language.h" -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/ImageTypes/ImageViewRGB32.h" #include "CommonFramework/Notifications/ProgramNotifications.h" #include "CommonFramework/VideoPipeline/VideoFeed.h" @@ -132,7 +132,7 @@ void GiftBerryReset::program(SingleSwitchProgramEnvironment& env, ProControllerC // dialog_detector.make_overlays(set); VideoSnapshot screen = env.console.video().snapshot(); if (!dialog_detector.detect(screen)){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "No npc dialog box found when reading berry name", env.console @@ -146,7 +146,7 @@ void GiftBerryReset::program(SingleSwitchProgramEnvironment& env, ProControllerC OCR::BLACK_TEXT_FILTERS() ); if (result.results.empty()){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "No berry name found in dialog box", env.console @@ -173,7 +173,7 @@ void GiftBerryReset::program(SingleSwitchProgramEnvironment& env, ProControllerC // Reset game: pbf_press_button(context, BUTTON_HOME, 80ms, GameSettings::instance().GAME_TO_HOME_DELAY0); if (!reset_game_from_home(env, env.console, context, ConsoleSettings::instance().TOLERATE_SYSTEM_UPDATE_MENU_FAST)){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Error resetting game", env.console diff --git a/SerialPrograms/Source/PokemonBDSP/Programs/Farming/PokemonBDSP_MoneyFarmerRoute210.cpp b/SerialPrograms/Source/PokemonBDSP/Programs/Farming/PokemonBDSP_MoneyFarmerRoute210.cpp index 84d6cadfbc..295d33c357 100644 --- a/SerialPrograms/Source/PokemonBDSP/Programs/Farming/PokemonBDSP_MoneyFarmerRoute210.cpp +++ b/SerialPrograms/Source/PokemonBDSP/Programs/Farming/PokemonBDSP_MoneyFarmerRoute210.cpp @@ -4,7 +4,7 @@ * */ -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/Notifications/ProgramNotifications.h" #include "CommonFramework/ProgramStats/StatsTracking.h" #include "CommonTools/Async/InferenceRoutines.h" @@ -201,7 +201,7 @@ bool MoneyFarmerRoute210::battle(SingleSwitchProgramEnvironment& env, ProControl } } if (slot == 4){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Ran out of PP in a battle.", env.console @@ -225,7 +225,7 @@ bool MoneyFarmerRoute210::battle(SingleSwitchProgramEnvironment& env, ProControl } } if (slot == 4){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Ran out of PP in a battle.", env.console @@ -260,7 +260,7 @@ bool MoneyFarmerRoute210::battle(SingleSwitchProgramEnvironment& env, ProControl } } - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "No progress detected after 5 battle menus. Are you out of PP?", env.console diff --git a/SerialPrograms/Source/PokemonBDSP/Programs/Farming/PokemonBDSP_MoneyFarmerRoute212.cpp b/SerialPrograms/Source/PokemonBDSP/Programs/Farming/PokemonBDSP_MoneyFarmerRoute212.cpp index 9f48829045..5aba149340 100644 --- a/SerialPrograms/Source/PokemonBDSP/Programs/Farming/PokemonBDSP_MoneyFarmerRoute212.cpp +++ b/SerialPrograms/Source/PokemonBDSP/Programs/Farming/PokemonBDSP_MoneyFarmerRoute212.cpp @@ -4,7 +4,7 @@ * */ -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/Notifications/ProgramNotifications.h" #include "CommonFramework/ProgramStats/StatsTracking.h" #include "CommonTools/Async/InferenceRoutines.h" @@ -158,7 +158,7 @@ bool MoneyFarmerRoute212::battle(SingleSwitchProgramEnvironment& env, ProControl } } if (slot == 4){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Ran out of PP in a battle.", env.console @@ -200,7 +200,7 @@ bool MoneyFarmerRoute212::battle(SingleSwitchProgramEnvironment& env, ProControl } } - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "No progress detected after 5 battle menus. Are you out of PP?", env.console diff --git a/SerialPrograms/Source/PokemonBDSP/Programs/Glitches/PokemonBDSP_ActivateMenuGlitch-1.1.2.cpp b/SerialPrograms/Source/PokemonBDSP/Programs/Glitches/PokemonBDSP_ActivateMenuGlitch-1.1.2.cpp index fb65817ff5..59adbad0dc 100644 --- a/SerialPrograms/Source/PokemonBDSP/Programs/Glitches/PokemonBDSP_ActivateMenuGlitch-1.1.2.cpp +++ b/SerialPrograms/Source/PokemonBDSP/Programs/Glitches/PokemonBDSP_ActivateMenuGlitch-1.1.2.cpp @@ -4,7 +4,7 @@ * */ -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/VideoPipeline/VideoFeed.h" #include "CommonTools/Async/InferenceRoutines.h" #include "CommonTools/VisualDetectors/BlackScreenDetector.h" @@ -68,7 +68,7 @@ void trigger_menu(VideoStream& stream, ProControllerContext& context){ {{detector}} ); if (ret < 0){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Map not detected after 60 seconds.", stream @@ -103,7 +103,7 @@ void trigger_map_overlap(VideoStream& stream, ProControllerContext& context){ pbf_mash_button(context, BUTTON_B, 3000ms); pbf_press_button(context, BUTTON_R, 160ms, 1840ms); } - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Failed to trigger map overlap after 10 attempts.", stream @@ -146,7 +146,7 @@ void ActivateMenuGlitch112::program(SingleSwitchProgramEnvironment& env, ProCont {{detector}} ); if (ret < 0){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Unable to leave " + STRING_POKEMON + " center.", stream diff --git a/SerialPrograms/Source/PokemonBDSP/Programs/Glitches/PokemonBDSP_ActivateMenuGlitch-1.1.3.cpp b/SerialPrograms/Source/PokemonBDSP/Programs/Glitches/PokemonBDSP_ActivateMenuGlitch-1.1.3.cpp index 0b180c6481..c8b35dd43f 100644 --- a/SerialPrograms/Source/PokemonBDSP/Programs/Glitches/PokemonBDSP_ActivateMenuGlitch-1.1.3.cpp +++ b/SerialPrograms/Source/PokemonBDSP/Programs/Glitches/PokemonBDSP_ActivateMenuGlitch-1.1.3.cpp @@ -5,7 +5,7 @@ */ #include -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonTools/Async/InferenceRoutines.h" #include "CommonTools/StartupChecks/StartProgramChecks.h" #include "NintendoSwitch/Commands/NintendoSwitch_Commands_PushButtons.h" @@ -72,7 +72,7 @@ void ActivateMenuGlitch113::program(SingleSwitchProgramEnvironment& env, ProCont {{detector}} ); if (ret < 0){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Map not detected after 2 seconds.", stream diff --git a/SerialPrograms/Source/PokemonBDSP/Programs/Glitches/PokemonBDSP_CloneItemsBoxCopy2.cpp b/SerialPrograms/Source/PokemonBDSP/Programs/Glitches/PokemonBDSP_CloneItemsBoxCopy2.cpp index daf7dd61fd..84051e135d 100644 --- a/SerialPrograms/Source/PokemonBDSP/Programs/Glitches/PokemonBDSP_CloneItemsBoxCopy2.cpp +++ b/SerialPrograms/Source/PokemonBDSP/Programs/Glitches/PokemonBDSP_CloneItemsBoxCopy2.cpp @@ -4,7 +4,7 @@ * */ -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/VideoPipeline/VideoFeed.h" #include "CommonFramework/Notifications/ProgramNotifications.h" #include "CommonFramework/ProgramStats/StatsTracking.h" @@ -178,7 +178,7 @@ void CloneItemsBoxCopy2::program(SingleSwitchProgramEnvironment& env, ProControl context.wait_for(std::chrono::milliseconds(500)); if (!matcher.detect(env.console.video().snapshot())){ stats.m_errors++; - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Failed to return to starting position. Something is wrong.", env.console diff --git a/SerialPrograms/Source/PokemonBDSP/Programs/PokemonBDSP_BasicCatcher.cpp b/SerialPrograms/Source/PokemonBDSP/Programs/PokemonBDSP_BasicCatcher.cpp index 30f55c011e..36fd50df0b 100644 --- a/SerialPrograms/Source/PokemonBDSP/Programs/PokemonBDSP_BasicCatcher.cpp +++ b/SerialPrograms/Source/PokemonBDSP/Programs/PokemonBDSP_BasicCatcher.cpp @@ -4,7 +4,7 @@ * */ -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/VideoPipeline/VideoFeed.h" #include "CommonTools/Async/InferenceRoutines.h" #include "NintendoSwitch/Commands/NintendoSwitch_Commands_PushButtons.h" @@ -244,7 +244,7 @@ CatchResults basic_catcher( return results; case 1: if (results.result == CatchResult::POKEMON_CAUGHT){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "BasicCatcher: Found receive pokemon screen two times.", stream @@ -258,7 +258,7 @@ CatchResults basic_catcher( stream.log("BasicCatcher: Detected move learn! Don't learn the new move.", COLOR_BLUE); num_learned_moves++; if (num_learned_moves == 100){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "BasicCatcher: Learn new move attempts reach 100.", stream diff --git a/SerialPrograms/Source/PokemonBDSP/Programs/PokemonBDSP_EncounterHandler.cpp b/SerialPrograms/Source/PokemonBDSP/Programs/PokemonBDSP_EncounterHandler.cpp index 53652afac1..6a72060914 100644 --- a/SerialPrograms/Source/PokemonBDSP/Programs/PokemonBDSP_EncounterHandler.cpp +++ b/SerialPrograms/Source/PokemonBDSP/Programs/PokemonBDSP_EncounterHandler.cpp @@ -5,7 +5,7 @@ */ #include -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/Exceptions/FatalProgramException.h" #include "CommonFramework/Tools/ProgramEnvironment.h" #include "NintendoSwitch/Commands/NintendoSwitch_Commands_PushButtons.h" @@ -105,7 +105,7 @@ bool StandardEncounterHandler::handle_standard_encounter(const DoublesShinyDetec m_session_stats.add_error(); m_consecutive_failures++; if (m_consecutive_failures >= 3){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "3 consecutive failed encounter detections.", m_stream @@ -168,7 +168,7 @@ bool StandardEncounterHandler::handle_standard_encounter_end_battle( m_session_stats.add_error(); m_consecutive_failures++; if (m_consecutive_failures >= 3){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "3 consecutive failed encounter detections.", m_stream diff --git a/SerialPrograms/Source/PokemonBDSP/Programs/PokemonBDSP_GameNavigation.cpp b/SerialPrograms/Source/PokemonBDSP/Programs/PokemonBDSP_GameNavigation.cpp index a30dbf2ddc..e5df8af92c 100644 --- a/SerialPrograms/Source/PokemonBDSP/Programs/PokemonBDSP_GameNavigation.cpp +++ b/SerialPrograms/Source/PokemonBDSP/Programs/PokemonBDSP_GameNavigation.cpp @@ -4,7 +4,7 @@ * */ -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonTools/Async/InferenceRoutines.h" #include "NintendoSwitch/Commands/NintendoSwitch_Commands_PushButtons.h" #include "PokemonBDSP/PokemonBDSP_Settings.h" @@ -74,7 +74,7 @@ void overworld_to_menu(VideoStream& stream, ProControllerContext& context){ {{detector}} ); if (ret < 0){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Menu not detected after 10 seconds.", stream @@ -109,7 +109,7 @@ void overworld_to_box(VideoStream& stream, ProControllerContext& context){ {{detector}} ); if (ret < 0){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Box system not detected after 10 seconds.", stream @@ -144,7 +144,7 @@ void box_to_overworld(VideoStream& stream, ProControllerContext& context){ {{detector}} ); if (ret < 0){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Menu not detected after 10 seconds.", stream diff --git a/SerialPrograms/Source/PokemonBDSP/Programs/PokemonBDSP_GlobalRoomHeal.cpp b/SerialPrograms/Source/PokemonBDSP/Programs/PokemonBDSP_GlobalRoomHeal.cpp index 5365f65381..cb578a6fb4 100644 --- a/SerialPrograms/Source/PokemonBDSP/Programs/PokemonBDSP_GlobalRoomHeal.cpp +++ b/SerialPrograms/Source/PokemonBDSP/Programs/PokemonBDSP_GlobalRoomHeal.cpp @@ -4,7 +4,7 @@ * */ -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonTools/Async/InferenceRoutines.h" #include "NintendoSwitch/Commands/NintendoSwitch_Commands_PushButtons.h" #include "PokemonBDSP/Inference/PokemonBDSP_SelectionArrow.h" @@ -38,7 +38,7 @@ bool heal_by_global_room(VideoStream& stream, ProControllerContext& context){ {{arrow}} ); if (ret < 0){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "No selection arrow detected when using Global Room.", stream diff --git a/SerialPrograms/Source/PokemonBDSP/Programs/PokemonBDSP_OverworldTrigger.cpp b/SerialPrograms/Source/PokemonBDSP/Programs/PokemonBDSP_OverworldTrigger.cpp index 9f08572179..42ec30bcfc 100644 --- a/SerialPrograms/Source/PokemonBDSP/Programs/PokemonBDSP_OverworldTrigger.cpp +++ b/SerialPrograms/Source/PokemonBDSP/Programs/PokemonBDSP_OverworldTrigger.cpp @@ -4,7 +4,7 @@ * */ -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonTools/Async/InferenceRoutines.h" #include "NintendoSwitch/Commands/NintendoSwitch_Commands_PushButtons.h" #include "NintendoSwitch/Commands/NintendoSwitch_Commands_Superscalar.h" @@ -166,7 +166,7 @@ bool OverworldTrigger::find_encounter(VideoStream& stream, ProControllerContext& } ); if (ret < 0){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Battle not detected after Sweet Scent for 30 seconds.", stream diff --git a/SerialPrograms/Source/PokemonBDSP/Programs/ShinyHunting/PokemonBDSP_ShinyHunt-Overworld.cpp b/SerialPrograms/Source/PokemonBDSP/Programs/ShinyHunting/PokemonBDSP_ShinyHunt-Overworld.cpp index 48bc0044fa..52b69d831d 100644 --- a/SerialPrograms/Source/PokemonBDSP/Programs/ShinyHunting/PokemonBDSP_ShinyHunt-Overworld.cpp +++ b/SerialPrograms/Source/PokemonBDSP/Programs/ShinyHunting/PokemonBDSP_ShinyHunt-Overworld.cpp @@ -4,7 +4,8 @@ * */ -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/ErrorReports/ErrorReports.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/Notifications/ProgramNotifications.h" #include "NintendoSwitch/NintendoSwitch_Settings.h" #include "NintendoSwitch/Commands/NintendoSwitch_Commands_PushButtons.h" @@ -148,11 +149,21 @@ void ShinyHuntOverworld::program(SingleSwitchProgramEnvironment& env, ProControl } lead_tracker.report_result(result_own.shiny_type); - }catch (OperationFailedException& e){ + }catch (OperationFailedExceptionWithScreenshot& e){ if (!RESET_GAME_WHEN_ERROR){ throw; } - e.send_notification(env, NOTIFICATION_ERROR_RECOVERABLE); + send_program_recoverable_error_notification(env, NOTIFICATION_ERROR_RECOVERABLE, e.message(), *e.screenshot()); + if (e.error_report_mode() == ErrorReport::SEND_ERROR_REPORT){ + PokemonAutomation::report_error( + &env.logger(), + env.program_info(), + "Recoverable: OperationFailedExceptionWithScreenshot", + {{"Message:", e.message()}}, + *e.screenshot(), + &e.video_stream()->history() + ); + } stats.add_error(); go_home(env.console, context); diff --git a/SerialPrograms/Source/PokemonBDSP/Programs/ShinyHunting/PokemonBDSP_StarterReset.cpp b/SerialPrograms/Source/PokemonBDSP/Programs/ShinyHunting/PokemonBDSP_StarterReset.cpp index b328be5c7a..d6368d8219 100644 --- a/SerialPrograms/Source/PokemonBDSP/Programs/ShinyHunting/PokemonBDSP_StarterReset.cpp +++ b/SerialPrograms/Source/PokemonBDSP/Programs/ShinyHunting/PokemonBDSP_StarterReset.cpp @@ -5,7 +5,7 @@ */ #include "CommonFramework/GlobalAutoPaths.h" -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/ImageTypes/ImageViewRGB32.h" #include "CommonFramework/Tools/ErrorDumper.h" #include "CommonTools/Async/InferenceRoutines.h" @@ -118,7 +118,7 @@ void StarterReset::program(SingleSwitchProgramEnvironment& env, ProControllerCon env.update_stats(); if (consecutive_failures >= 3){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Failed 3 times in the row.", env.console diff --git a/SerialPrograms/Source/PokemonFRLG/PokemonFRLG_Navigation.cpp b/SerialPrograms/Source/PokemonFRLG/PokemonFRLG_Navigation.cpp index 29faf37450..e5bd9c7c34 100644 --- a/SerialPrograms/Source/PokemonFRLG/PokemonFRLG_Navigation.cpp +++ b/SerialPrograms/Source/PokemonFRLG/PokemonFRLG_Navigation.cpp @@ -7,7 +7,7 @@ */ #include -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/VideoPipeline/VideoFeed.h" #include "CommonTools/Random.h" #include "CommonTools/Async/InferenceRoutines.h" @@ -175,7 +175,7 @@ uint64_t soft_reset(ConsoleHandle& console, ProControllerContext& context){ return errors; } } - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "soft_reset(): Failed to reset after 5 attempts.", console @@ -299,7 +299,7 @@ uint64_t open_slot_six(ConsoleHandle& console, ProControllerContext& context){ pbf_mash_button(context, BUTTON_B, 10000ms); } } - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "open_slot_six(): Failed to open party summary after 5 attempts.", console @@ -325,7 +325,7 @@ bool handle_encounter(ConsoleHandle& console, ProControllerContext& context, boo if (ret == 0){ console.log("Battle Advance arrow detected."); }else{ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "handle_encounter(): Did not detect battle advance arrow.", console @@ -348,7 +348,7 @@ bool handle_encounter(ConsoleHandle& console, ProControllerContext& context, boo if (ret2 == 0){ console.log("Battle menu detecteed!"); }else{ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "handle_encounter(): Did not detect battle menu.", console @@ -376,7 +376,7 @@ bool handle_encounter(ConsoleHandle& console, ProControllerContext& context, boo while (true){ if (current_time() - start > 60s){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "handle_encounter(): No battle menu detected after sixty seconds.", console @@ -418,13 +418,13 @@ BattleResult spam_first_move(ConsoleHandle& console, ProControllerContext& conte uint16_t times_moved = 0; while (true){ if (errors > 5) { - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "spam_first_move(): Failed to use move 5 times.", console ); } else if (times_moved > 50){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "spam_first_move(): More than 50 move uses detected.", console @@ -502,7 +502,7 @@ void flee_battle(ConsoleHandle& console, ProControllerContext& context){ while (true) { if (errors > 5){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "flee_battle(): Failed to flee battle after 5 attempts.", console @@ -584,7 +584,7 @@ bool exit_wild_battle(ConsoleHandle& console, ProControllerContext& context, boo bool move_learned = false; while (true){ if (errors > 5 || loops > 5){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "exit_wild_battle(): Failed to exit battle.", console @@ -704,7 +704,7 @@ void open_party_menu_from_overworld(ConsoleHandle& console, ProControllerContext bool start_menu_is_open = false; while (true){ if (errors > 5){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "open_party_menu_from_overworld(): Failed to open party menu 5 times in a row.", console @@ -785,7 +785,7 @@ void open_bag_from_overworld(ConsoleHandle& console, ProControllerContext& conte bool start_menu_is_open = false; while (true){ if (errors > 5){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "open_party_menu_from_overworld(): Failed to open party menu 5 times in a row.", console @@ -846,7 +846,7 @@ void use_sweet_scent_from_overworld(ConsoleHandle& console, ProControllerContext while (true){ if (errors > 5){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "use_teleport_from_overworld(): Failed to use Teleport 5 times in a row.", console @@ -893,7 +893,7 @@ void use_teleport_from_overworld(ConsoleHandle& console, ProControllerContext& c while (true){ if (errors > 5){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "use_teleport_from_overworld(): Failed to use Teleport 5 times in a row.", console @@ -954,7 +954,7 @@ void open_fly_map_from_overworld(ConsoleHandle& console, ProControllerContext& c uint16_t errors = 0; while (true){ if (errors > 5){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "open_fly_map_from_overworld(): Failed to open Fly map 5 times in a row.", console @@ -1013,7 +1013,7 @@ void fly_from_kanto_map(ConsoleHandle& console, ProControllerContext& context, K while (true){ if (errors > 5){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "fly_from_kanto_map(): Failed to inititate Fly five times in a row.", console @@ -1078,7 +1078,7 @@ void fly_from_kanto_map(ConsoleHandle& console, ProControllerContext& context, K pbf_move_left_joystick(context, {+1, 0}, 150ms, 100ms); break; default: - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "fly_from_kanto_map(): Unimplemented Kanto fly target.", console @@ -1117,7 +1117,7 @@ void enter_leave_pokecenter(ConsoleHandle& console, ProControllerContext& contex while (true){ if (errors > 5){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, leave ? "leave_pokecenter(): Failed to exit PokeCenter." : "enter_pokecenter(): Failed to enter PokeCenter.", console @@ -1161,7 +1161,7 @@ void heal_at_pokecenter(ConsoleHandle& console, ProControllerContext& context){ while (true){ if (errors > 5){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "heal_at_pokecenter(): Failed to initiate PokeCenter dialog.", console @@ -1264,7 +1264,7 @@ void exit_battle_after_catch( if (in_overworld(console, context)){ return; } - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "exit_battle_after_catch(): Failed to exit the battle.", console diff --git a/SerialPrograms/Source/PokemonFRLG/Programs/Farming/PokemonFRLG_EvTrainer.cpp b/SerialPrograms/Source/PokemonFRLG/Programs/Farming/PokemonFRLG_EvTrainer.cpp index f8e2238d2d..9b13135804 100644 --- a/SerialPrograms/Source/PokemonFRLG/Programs/Farming/PokemonFRLG_EvTrainer.cpp +++ b/SerialPrograms/Source/PokemonFRLG/Programs/Farming/PokemonFRLG_EvTrainer.cpp @@ -6,7 +6,7 @@ #include #include -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/ProgramStats/StatsTracking.h" #include "CommonFramework/Notifications/ProgramNotifications.h" #include "CommonFramework/ProgramStats/StatsTracking.h" @@ -282,7 +282,7 @@ void travel_to_surf_spot(SingleSwitchProgramEnvironment& env, ProControllerConte int errors = 0; while (true){ if (errors > 3){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Failed to surf 3 times in a row.", env.console @@ -338,7 +338,7 @@ void use_dig(SingleSwitchProgramEnvironment& env, ProControllerContext& context) uint16_t errors = 0; while (true){ if (errors > 5){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Failed to use Dig 5 times in a row.", env.console @@ -480,7 +480,7 @@ EvTrainer::EvTrainingLocation EvTrainer::get_next_location(SingleSwitchProgramEn }else if (stats.spe_evs < SPEED_EVS){ return EvTrainingLocation::route1; }else{ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "EvTrainer(): program failed to exit after earning all EVs", env.console @@ -509,7 +509,7 @@ bool EvTrainer::travel_to_location(SingleSwitchProgramEnvironment& env, ProContr travel_to_route1(env, context); return true; default: - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "EvTrainer: Invalid EV Training location.", env.console @@ -584,7 +584,7 @@ EvTrainer::EffortValues EvTrainer::get_ev_yield(SingleSwitchProgramEnvironment& env.log("get_ev_yield(): failed to detect species"); return {999, 999, 999, 999, 999, 999}; // this will always trigger running away }else if (ev_map.find(species) == ev_map.end()){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "get_ev_yield(): Missing EV yield for " + species, env.console @@ -720,7 +720,7 @@ void EvTrainer::program(SingleSwitchProgramEnvironment& env, ProControllerContex while (!finished_all){ try{ if (failed_encounters >= 5){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Failed to trigger a wild encounter within 60 seconds 5 times in a row", env.console diff --git a/SerialPrograms/Source/PokemonFRLG/Programs/Farming/PokemonFRLG_HeldItemFarmer-SafariZone.cpp b/SerialPrograms/Source/PokemonFRLG/Programs/Farming/PokemonFRLG_HeldItemFarmer-SafariZone.cpp index d4faf39083..fec95e6111 100644 --- a/SerialPrograms/Source/PokemonFRLG/Programs/Farming/PokemonFRLG_HeldItemFarmer-SafariZone.cpp +++ b/SerialPrograms/Source/PokemonFRLG/Programs/Farming/PokemonFRLG_HeldItemFarmer-SafariZone.cpp @@ -6,7 +6,7 @@ #include "CommonFramework/GlobalSettingsPanel.h" #include "Common/Cpp/Options/ButtonOption.h" -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/ImageTools/ImageBoxes.h" #include "CommonFramework/Language.h" #include "CommonFramework/Notifications/ProgramNotifications.h" @@ -475,7 +475,7 @@ bool HeldItemFarmerSafariZone::run_safari_zone(SingleSwitchProgramEnvironment& e bool caught = false; if (catch_result < 0){ stats.errors++; - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "auto_catch_safari() encountered an error.", env.console diff --git a/SerialPrograms/Source/PokemonFRLG/Programs/Farming/PokemonFRLG_ItemDuplication.cpp b/SerialPrograms/Source/PokemonFRLG/Programs/Farming/PokemonFRLG_ItemDuplication.cpp index 970c423420..34acfa0781 100644 --- a/SerialPrograms/Source/PokemonFRLG/Programs/Farming/PokemonFRLG_ItemDuplication.cpp +++ b/SerialPrograms/Source/PokemonFRLG/Programs/Farming/PokemonFRLG_ItemDuplication.cpp @@ -5,7 +5,7 @@ */ #include "Common/Cpp/Color.h" -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/Notifications/ProgramNotifications.h" #include "CommonFramework/ProgramStats/StatsTracking.h" #include "CommonTools/Async/InferenceRoutines.h" @@ -107,7 +107,7 @@ void ItemDuplication::program(SingleSwitchProgramEnvironment& env, ProController if (ret < 0) { stats.errors++; env.update_stats(); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "program(): Unable to detect selection arrow for Retro Mail. Please ensure Retro Mail is the top slot.", env.console @@ -128,7 +128,7 @@ void ItemDuplication::program(SingleSwitchProgramEnvironment& env, ProController if (ret2 < 0) { stats.errors++; env.update_stats(); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "program(): Unable to detect farfetchd held item. Please ensure farfetchd is holding an item to duplicate.", env.console @@ -147,7 +147,7 @@ void ItemDuplication::program(SingleSwitchProgramEnvironment& env, ProController if (ret3 < 0) { stats.errors++; env.update_stats(); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "program(): Unable to detect item description.", env.console @@ -166,7 +166,7 @@ void ItemDuplication::program(SingleSwitchProgramEnvironment& env, ProController if (ret4 < 0) { stats.errors++; env.update_stats(); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "program(): Unable to detect confirmation prompt.", env.console @@ -190,7 +190,7 @@ void ItemDuplication::program(SingleSwitchProgramEnvironment& env, ProController if (ret5 < 0) { stats.errors++; env.update_stats(); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "program(): Unable to detect confirmation prompt on mail screen.", env.console diff --git a/SerialPrograms/Source/PokemonFRLG/Programs/Farming/PokemonFRLG_PickupFarmer.cpp b/SerialPrograms/Source/PokemonFRLG/Programs/Farming/PokemonFRLG_PickupFarmer.cpp index 062762addb..e74752ab8a 100644 --- a/SerialPrograms/Source/PokemonFRLG/Programs/Farming/PokemonFRLG_PickupFarmer.cpp +++ b/SerialPrograms/Source/PokemonFRLG/Programs/Farming/PokemonFRLG_PickupFarmer.cpp @@ -4,7 +4,7 @@ * */ -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/ProgramStats/StatsTracking.h" #include "CommonFramework/Notifications/ProgramNotifications.h" #include "CommonFramework/ProgramStats/StatsTracking.h" @@ -186,7 +186,7 @@ void take_pickup_items(SingleSwitchProgramEnvironment& env, ProControllerContext { selection_open } ); if (ret < 0){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Failed to detect selection menu.", env.console @@ -237,7 +237,7 @@ void PickupFarmer::program(SingleSwitchProgramEnvironment& env, ProControllerCon use_teleport_from_overworld(env.console, context); break; default: - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Travel option not recognized. Please report this as a bug.", env.console @@ -255,7 +255,7 @@ void PickupFarmer::program(SingleSwitchProgramEnvironment& env, ProControllerCon walk_to_route22(env, context); break; default: - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Game location not recognized. Please report this as a bug.", env.console @@ -275,7 +275,7 @@ void PickupFarmer::program(SingleSwitchProgramEnvironment& env, ProControllerCon env.log("Failed to trigger encounter: traveling back to PokeCenter"); errors++; if (errors >= 5){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Failed 5 times to trigger a wild encounter within 60 seconds", env.console diff --git a/SerialPrograms/Source/PokemonFRLG/Programs/PokemonFRLG_StartMenuNavigation.cpp b/SerialPrograms/Source/PokemonFRLG/Programs/PokemonFRLG_StartMenuNavigation.cpp index bc9f9b9641..ea0c1adc89 100644 --- a/SerialPrograms/Source/PokemonFRLG/Programs/PokemonFRLG_StartMenuNavigation.cpp +++ b/SerialPrograms/Source/PokemonFRLG/Programs/PokemonFRLG_StartMenuNavigation.cpp @@ -5,7 +5,7 @@ */ #include "Common/Cpp/Time.h" -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonTools/Async/InferenceRoutines.h" #include "NintendoSwitch/Commands/NintendoSwitch_Commands_PushButtons.h" #include "NintendoSwitch/Controllers/Procon/NintendoSwitch_ProController.h" @@ -23,7 +23,7 @@ void open_start_menu(ConsoleHandle& console, ProControllerContext& context){ while(true){ if (errors > 5){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Failed to open Start menu 5 times in a row.", console @@ -152,7 +152,7 @@ void save_game_to_overworld(ConsoleHandle& console, ProControllerContext& contex context.wait_for_all_requests(); if (current_time() - start > std::chrono::seconds(120)){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "save_game_to_overworld(): Unable to save game after 2 minutes.", console diff --git a/SerialPrograms/Source/PokemonFRLG/Programs/RngManipulation/PokemonFRLG_BlindNavigation.cpp b/SerialPrograms/Source/PokemonFRLG/Programs/RngManipulation/PokemonFRLG_BlindNavigation.cpp index 3bdd866977..3e2ff2e09b 100644 --- a/SerialPrograms/Source/PokemonFRLG/Programs/RngManipulation/PokemonFRLG_BlindNavigation.cpp +++ b/SerialPrograms/Source/PokemonFRLG/Programs/RngManipulation/PokemonFRLG_BlindNavigation.cpp @@ -5,7 +5,7 @@ */ #include "CommonTools/Random.h" -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "NintendoSwitch/Commands/NintendoSwitch_Commands_PushButtons.h" #include "NintendoSwitch/Commands/NintendoSwitch_Commands_Superscalar.h" #include "NintendoSwitch/Controllers/Procon/NintendoSwitch_ProController.h" @@ -435,14 +435,14 @@ void check_timings( bool safari_zone ){ if (timings.csf_delay < 3200){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::NO_ERROR_REPORT, "The Continue Screen delay cannot be less than 3200ms (192 advances). Check your Continue Screen calibration.", console ); } if (timings.seed_delay < 29650){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::NO_ERROR_REPORT, "The title screen delay cannot be less than 30s. Check your seed delay and calibration.", console @@ -452,7 +452,7 @@ void check_timings( switch (TARGET){ case PokemonFRLG_RngTarget::starters: if (timings.ingame_delay < 7500){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::NO_ERROR_REPORT, "Starters: the in-game delay cannot be less than 7500ms (740 advances). Check your in-game advances and calibration or pick a new target.", console @@ -461,7 +461,7 @@ void check_timings( return; case PokemonFRLG_RngTarget::magikarp: if (timings.ingame_delay < 7500){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::NO_ERROR_REPORT, "Magikarp: the in-game delay cannot be less than 7500ms (740 advances). Check your in-game advances and calibration or pick a new target.", console @@ -472,7 +472,7 @@ void check_timings( case PokemonFRLG_RngTarget::hitmonlee: case PokemonFRLG_RngTarget::hitmon: if (timings.ingame_delay < 4500){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::NO_ERROR_REPORT, "Hitmonchan/Hitmonlee: the in-game delay cannot be less than 4500ms (380 advances). Check your in-game advances and calibration or pick a new target.", console @@ -481,7 +481,7 @@ void check_timings( return; case PokemonFRLG_RngTarget::eevee: if (timings.ingame_delay < 4000){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::NO_ERROR_REPORT, "Eevee: the in-game delay cannot be less than 4000ms (320 advances). Check your in-game advances and calibration or pick a new target.", console @@ -490,7 +490,7 @@ void check_timings( return; case PokemonFRLG_RngTarget::lapras: if (timings.ingame_delay < 7500){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::NO_ERROR_REPORT, "Lapras: the in-game delay cannot be less than 7500ms (740 advances). Check your in-game advances and calibration or pick a new target.", console @@ -502,7 +502,7 @@ void check_timings( case PokemonFRLG_RngTarget::aerodactyl: case PokemonFRLG_RngTarget::fossils: if (timings.ingame_delay < 6000){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::NO_ERROR_REPORT, "Fossils: the in-game delay cannot be less than 6000ms (560 advances). Check your in-game advances and calibration or pick a new target.", console @@ -517,7 +517,7 @@ void check_timings( case PokemonFRLG_RngTarget::gamecornerpinsir: case PokemonFRLG_RngTarget::gamecornerporygon: if (timings.ingame_delay < 8500){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::NO_ERROR_REPORT, "Game Corner: the in-game delay cannot be less than 8500ms (860 advances). Check your in-game advances and calibration or pick a new target.", console @@ -526,7 +526,7 @@ void check_timings( return; case PokemonFRLG_RngTarget::togepi: if (timings.ingame_delay < 12000) { - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::NO_ERROR_REPORT, "Togepi: the in-game delay cannot be less than 12000ms (1280 advances). Check your in-game advances and calibration or pick a new target.", console @@ -535,7 +535,7 @@ void check_timings( return; case PokemonFRLG_RngTarget::togepifast: if (timings.ingame_delay < 5500){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::NO_ERROR_REPORT, "Togepi (pre-approved): the in-game delay cannot be less than 5500ms (500 advances). Check your in-game advances and calibration or pick a new target.", console @@ -544,7 +544,7 @@ void check_timings( return; case PokemonFRLG_RngTarget::eggheld: if (timings.ingame_delay < 4000) { - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::NO_ERROR_REPORT, "Held Frame: the in-game delay cannot be less than 4000ms (350 advances). Check your in-game advances and calibration or pick a new target.", console @@ -553,7 +553,7 @@ void check_timings( return; case PokemonFRLG_RngTarget::eggpickup: if (timings.ingame_delay < 12000) { - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::NO_ERROR_REPORT, "Pickup Frame: the in-game delay cannot be less than 12000ms (1440 advances). Check your in-game advances and calibration or pick a new target.", console @@ -569,7 +569,7 @@ void check_timings( case PokemonFRLG_RngTarget::deoxys_defense: case PokemonFRLG_RngTarget::staticencounter: if (timings.ingame_delay < 5000){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::NO_ERROR_REPORT, "Static Encounter: the in-game delay cannot be less than 5000ms (440 advances). Check your in-game advances and calibration or pick a new target.", console @@ -578,7 +578,7 @@ void check_timings( return; case PokemonFRLG_RngTarget::snorlax: if (timings.ingame_delay < 16000){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::NO_ERROR_REPORT, "Snorlax: the in-game delay cannot be less than 16000ms (1760 advances). Check your in-game advances and calibration or pick a new target.", console @@ -587,7 +587,7 @@ void check_timings( return; case PokemonFRLG_RngTarget::mewtwo: if (timings.ingame_delay < 4500){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::NO_ERROR_REPORT, "Mewtwo: the in-game delay cannot be less than 4500ms (380 advances). Check your in-game advances and calibration or pick a new target.", console @@ -596,7 +596,7 @@ void check_timings( return; case PokemonFRLG_RngTarget::hooh: if (timings.ingame_delay < 4000){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::NO_ERROR_REPORT, "Ho-oh: the in-game delay cannot be less than 4000ms (320 advances). Check your in-game advances and calibration or pick a new target.", console @@ -605,7 +605,7 @@ void check_timings( return; case PokemonFRLG_RngTarget::hypno: if (timings.ingame_delay < 13000){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::NO_ERROR_REPORT, "Hypno: the in-game delay cannot be less than 13000ms (1400 advances). Check your in-game advances and calibration or pick a new target.", console @@ -614,13 +614,13 @@ void check_timings( return; case PokemonFRLG_RngTarget::sweetscent: if (!safari_zone && timings.ingame_delay < 8500){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::NO_ERROR_REPORT, "Sweet Scent: the in-game delay cannot be less than 8500ms (1372 advances). Check your in-game advances and calibration or pick a new target.", console ); }else if (safari_zone && timings.ingame_delay < 9500){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::NO_ERROR_REPORT, "Sweet Scent: the in-game delay cannot be less than 9500ms (1492 advances). Check your in-game advances and calibration or pick a new target.", console @@ -629,7 +629,7 @@ void check_timings( return; case PokemonFRLG_RngTarget::rocksmash: if (timings.ingame_delay < 6500){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::NO_ERROR_REPORT, "Rock Smash: the in-game delay cannot be less than 7000ms (1192 advances). Check your in-game advances and calibration or pick a new target.", console @@ -637,7 +637,7 @@ void check_timings( } case PokemonFRLG_RngTarget::fishing: if (timings.ingame_delay < 5500){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::NO_ERROR_REPORT, "Fishing: the in-game delay cannot be less than 5500ms (500 advances). Check your in-game advances and calibration or pick a new target.", console @@ -646,7 +646,7 @@ void check_timings( return; case PokemonFRLG_RngTarget::safarizonecenter: if (timings.ingame_delay < 40500){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::NO_ERROR_REPORT, "Safari Zone Center: in-game delay cannot be less than 40500ms (5212 advances). Check your in-game advances and calibration or pick a new target.", console @@ -655,7 +655,7 @@ void check_timings( return; case PokemonFRLG_RngTarget::safarizoneeast: if (timings.ingame_delay < 46500){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::NO_ERROR_REPORT, "Safari Zone East: in-game delay cannot be less than 46500ms (5932 advances). Check your in-game advances and calibration or pick a new target.", console @@ -664,7 +664,7 @@ void check_timings( return; case PokemonFRLG_RngTarget::safarizonenorth: if (timings.ingame_delay < 47500){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::NO_ERROR_REPORT, "Safari Zone North: in-game delay cannot be less than 47500ms (6052 advances). Check your in-game advances and calibration or pick a new target.", console @@ -673,7 +673,7 @@ void check_timings( return; case PokemonFRLG_RngTarget::safarizonewest: if (timings.ingame_delay < 61500){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::NO_ERROR_REPORT, "Safari Zone West: in-game delay cannot be less than 61500ms (7732 advances). Check your in-game advances and calibration or pick a new target.", console @@ -682,7 +682,7 @@ void check_timings( return; case PokemonFRLG_RngTarget::safarizonesurf: if (timings.ingame_delay < 47500){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::NO_ERROR_REPORT, "Safari Zone Surfing: in-game delay cannot be less than 47500ms (6052 advances). Check your in-game advances and calibration or pick a new target.", console @@ -691,7 +691,7 @@ void check_timings( return; case PokemonFRLG_RngTarget::safarizonefish: if (timings.ingame_delay < 36500){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::NO_ERROR_REPORT, "Safari Zone Fishing: in-game delay cannot be less than 36500ms (4220 advances). Check your in-game advances and calibration or pick a new target.", console @@ -703,7 +703,7 @@ void check_timings( case PokemonFRLG_RngTarget::suicune: case PokemonFRLG_RngTarget::roaming: if (timings.ingame_delay < 27000){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Roaming: the in-game delay cannot be less than 27000ms (3400 frames). Check your in-game advances and calibration.", console @@ -711,7 +711,7 @@ void check_timings( } return; default: - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::NO_ERROR_REPORT, "RNG target not recognized. Please report this as a bug.", console diff --git a/SerialPrograms/Source/PokemonFRLG/Programs/RngManipulation/PokemonFRLG_EggRng.cpp b/SerialPrograms/Source/PokemonFRLG/Programs/RngManipulation/PokemonFRLG_EggRng.cpp index 257575708d..40c8336578 100644 --- a/SerialPrograms/Source/PokemonFRLG/Programs/RngManipulation/PokemonFRLG_EggRng.cpp +++ b/SerialPrograms/Source/PokemonFRLG/Programs/RngManipulation/PokemonFRLG_EggRng.cpp @@ -7,7 +7,7 @@ #include #include #include "CommonTools/Random.h" -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/ProgramStats/StatsTracking.h" #include "CommonFramework/Notifications/ProgramNotifications.h" #include "CommonFramework/ProgramStats/StatsTracking.h" @@ -600,7 +600,7 @@ bool EggRng::held_frame_check( if (locked_in && !(definitely_hit_held_frame || possibly_hit_held_frame)){ STARTING_POINT.set(EggProgramState::held_prep); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "EggRng(): Missed held frame after saving. Restart the program after repeating the manual in-game setup.", env.console @@ -712,7 +712,7 @@ void EggRng::program(SingleSwitchProgramEnvironment& env, ProControllerContext& }catch (const InternalProgramError& err){ env.log(err.message()); env.log(EGG_SPECIES.slug()); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, err.message(), env.console @@ -740,7 +740,7 @@ void EggRng::program(SingleSwitchProgramEnvironment& env, ProControllerContext& const uint16_t TARGET_HELD_SEED = parse_seed(env.console, HELD_SEED); const SeedMatch held_match = seeds_db.find_seed(TARGET_HELD_SEED, SOUND, SEED_RADIUS); if (!held_match.found){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "EggRng(): Held Seed was not found in the seed database for this game version, language, and sound setting.", env.console @@ -753,7 +753,7 @@ void EggRng::program(SingleSwitchProgramEnvironment& env, ProControllerContext& const uint16_t TARGET_PICKUP_SEED = parse_seed(env.console, PICKUP_SEED); const SeedMatch pickup_match = seeds_db.find_seed(TARGET_PICKUP_SEED, SOUND, SEED_RADIUS); if (!pickup_match.found){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "EggRng(): Pickup Seed was not found in the seed database for this game version, language, and sound setting.", env.console @@ -845,7 +845,7 @@ void EggRng::program(SingleSwitchProgramEnvironment& env, ProControllerContext& if (failed_searches >= 5){ env.log("Failed to find any matches 5 times in a row"); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::NO_ERROR_REPORT, "Failed to find any matches 5 times in a row. Check your seed and advances settings.", env.console diff --git a/SerialPrograms/Source/PokemonFRLG/Programs/RngManipulation/PokemonFRLG_GiftRng.cpp b/SerialPrograms/Source/PokemonFRLG/Programs/RngManipulation/PokemonFRLG_GiftRng.cpp index fcb9b94740..8517f490ce 100644 --- a/SerialPrograms/Source/PokemonFRLG/Programs/RngManipulation/PokemonFRLG_GiftRng.cpp +++ b/SerialPrograms/Source/PokemonFRLG/Programs/RngManipulation/PokemonFRLG_GiftRng.cpp @@ -4,7 +4,7 @@ * */ -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/ProgramStats/StatsTracking.h" #include "CommonFramework/Notifications/ProgramNotifications.h" #include "CommonFramework/ProgramStats/StatsTracking.h" @@ -375,7 +375,7 @@ void GiftRng::program(SingleSwitchProgramEnvironment& env, ProControllerContext& if (failed_searches >= 5){ env.log("Failed to find any matches 5 times in a row"); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::NO_ERROR_REPORT, "Failed to find any matches 5 times in a row. Check your seed and advances settings.", env.console diff --git a/SerialPrograms/Source/PokemonFRLG/Programs/RngManipulation/PokemonFRLG_HardReset.cpp b/SerialPrograms/Source/PokemonFRLG/Programs/RngManipulation/PokemonFRLG_HardReset.cpp index 0ec9166033..fa525958dd 100644 --- a/SerialPrograms/Source/PokemonFRLG/Programs/RngManipulation/PokemonFRLG_HardReset.cpp +++ b/SerialPrograms/Source/PokemonFRLG/Programs/RngManipulation/PokemonFRLG_HardReset.cpp @@ -4,7 +4,7 @@ * */ -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/VideoPipeline/VideoFeed.h" #include "CommonFramework/ImageTools/ImageBoxes.h" #include "CommonTools/Async/InferenceRoutines.h" @@ -40,7 +40,7 @@ void rng_reset_and_return_home( WallClock deadline = current_time() + std::chrono::minutes(5); while (true){ if (current_time() > deadline){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "rng_start_game_and_return_home(): Failed to start game and return to Home within 5 minutes.", console @@ -205,7 +205,7 @@ void reset_and_perform_blind_sequence( uint8_t attempts = 0; while(true){ if (attempts >= 5){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "RngHelper(): Failed to reset the game 5 times in a row.", console @@ -256,7 +256,7 @@ void reset_and_detect_copyright_text(ConsoleHandle& console, ProControllerContex uint8_t attempts = 0; while(true){ if (attempts >= 5){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Failed to resume the game 5 times in a row.", console @@ -299,7 +299,7 @@ void reset_and_detect_copyright_text(ConsoleHandle& console, ProControllerContex 1ms // catch black screen as quickly as possible ); if (ret2 < 0){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Black screen detected for more than 10 seconds after starting game.", console diff --git a/SerialPrograms/Source/PokemonFRLG/Programs/RngManipulation/PokemonFRLG_RngLoopRoutines.cpp b/SerialPrograms/Source/PokemonFRLG/Programs/RngManipulation/PokemonFRLG_RngLoopRoutines.cpp index 3e25397e3a..f2e0f4cb17 100644 --- a/SerialPrograms/Source/PokemonFRLG/Programs/RngManipulation/PokemonFRLG_RngLoopRoutines.cpp +++ b/SerialPrograms/Source/PokemonFRLG/Programs/RngManipulation/PokemonFRLG_RngLoopRoutines.cpp @@ -8,7 +8,7 @@ #include #include "Common/Cpp/Time.h" #include "CommonTools/Random.h" -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/Notifications/ProgramNotifications.h" #include "NintendoSwitch/Commands/NintendoSwitch_Commands_PushButtons.h" #include "PokemonFRLG/PokemonFRLG_Navigation.h" @@ -117,7 +117,7 @@ WildCatchOutcome catch_wild_for_seed_id( int ret = watch_for_shiny_encounter(env.console, context); if (ret < 0){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "catch_wild_for_seed_id(): Failed to trigger battle", env.console diff --git a/SerialPrograms/Source/PokemonFRLG/Programs/RngManipulation/PokemonFRLG_RngNavigation.cpp b/SerialPrograms/Source/PokemonFRLG/Programs/RngManipulation/PokemonFRLG_RngNavigation.cpp index 9ed2ad7711..077f177f80 100644 --- a/SerialPrograms/Source/PokemonFRLG/Programs/RngManipulation/PokemonFRLG_RngNavigation.cpp +++ b/SerialPrograms/Source/PokemonFRLG/Programs/RngManipulation/PokemonFRLG_RngNavigation.cpp @@ -4,7 +4,7 @@ * */ -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/VideoPipeline/VideoFeed.h" #include "CommonTools/Async/InferenceRoutines.h" #include "NintendoSwitch/Commands/NintendoSwitch_Commands_PushButtons.h" @@ -94,7 +94,7 @@ AdvObservedPokemon read_summary( ); if (ret2 < 0){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "read_summary(): Failed to detect second summary screen.", console @@ -299,7 +299,7 @@ void hatch_togepi_egg(ConsoleHandle& console, ProControllerContext& context){ { egg_dialog } ); if (ret < 0){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Togepi: failed to hatch egg within 10 minutes. Check your in-game setup.", console @@ -331,7 +331,7 @@ void hatch_daycare_egg(ConsoleHandle& console, ProControllerContext& context){ { egg_dialog } ); if (ret < 0){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Daycare Egg: failed to hatch egg within 45 minutes. Check your in-game setup.", console @@ -360,7 +360,7 @@ void travel_from_celio_to_kanto(ConsoleHandle& console, ProControllerContext& co { dialog_detected } ); if (ret < 0){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "travel_from_celio_to_route2(): Failed to detect One Island sign.", console @@ -382,7 +382,7 @@ void travel_from_celio_to_kanto(ConsoleHandle& console, ProControllerContext& co { dialog_detected } ); if (ret2 < 0){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "travel_from_celio_to_route2(): Failed to initiate Seagallop ferry dialogue.", console @@ -400,7 +400,7 @@ void travel_from_celio_to_kanto(ConsoleHandle& console, ProControllerContext& co { black_screen } ); if (ret3 < 0){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "travel_from_celio_to_kanto(): Failed to initiate Seagallop ferry travel.", console @@ -454,7 +454,7 @@ int watch_for_shiny_encounter(ConsoleHandle& console, ProControllerContext& cont {battle_entered} ); if (ret < 0){ - // OperationFailedException::fire( + // OperationFailedExceptionWithScreenshot::fire( // ErrorReport::SEND_ERROR_REPORT, // "Failed to initiate encounter.", // console @@ -576,7 +576,7 @@ bool check_for_shiny( case PokemonFRLG_RngTarget::roaming: return encounter_roamer(console, context, language, subset) == 1; default: - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "RNG target not recognized. Please report this as a bug.", console @@ -622,7 +622,7 @@ void daycare_steps(ConsoleHandle& console, ProControllerContext& context){ { repel_over } ); if (ret < 0){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::NO_ERROR_REPORT, "daycare_steps(): No Max Repel dialogue box detected.", console @@ -690,7 +690,7 @@ void egg_pickup(ConsoleHandle& console, ProControllerContext& context){ { dialogue_cleared } ); if (ret < 0){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "egg_pickup(): Failed to clear dialogue before talking to the daycare man.", console @@ -710,7 +710,7 @@ void egg_pickup(ConsoleHandle& console, ProControllerContext& context){ { egg_prompt } ); if (ret < 0){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "egg_pickup(): Failed to detect the egg selection dialogue.", console @@ -732,7 +732,7 @@ void egg_pickup(ConsoleHandle& console, ProControllerContext& context){ { dialogue_over } ); if (ret < 0){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "egg_pickup(): Failed to return to the overworld after taking the egg.", console diff --git a/SerialPrograms/Source/PokemonFRLG/Programs/RngManipulation/PokemonFRLG_RoamingLegendaryRng.cpp b/SerialPrograms/Source/PokemonFRLG/Programs/RngManipulation/PokemonFRLG_RoamingLegendaryRng.cpp index 4e296c89d2..8ccc69dd56 100644 --- a/SerialPrograms/Source/PokemonFRLG/Programs/RngManipulation/PokemonFRLG_RoamingLegendaryRng.cpp +++ b/SerialPrograms/Source/PokemonFRLG/Programs/RngManipulation/PokemonFRLG_RoamingLegendaryRng.cpp @@ -4,7 +4,7 @@ * */ -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/ProgramStats/StatsTracking.h" #include "CommonFramework/Notifications/ProgramNotifications.h" #include "CommonFramework/ProgramStats/StatsTracking.h" @@ -302,7 +302,7 @@ void RoamingLegendaryRng::program(SingleSwitchProgramEnvironment& env, ProContro if (failed_searches >= 5){ env.log("Failed to find any matches 5 times in a row"); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::NO_ERROR_REPORT, "Failed to find any matches 5 times in a row. Check your seed and advances settings.", env.console @@ -312,7 +312,7 @@ void RoamingLegendaryRng::program(SingleSwitchProgramEnvironment& env, ProContro if (failed_to_encounter >= 5){ env.log("Failed to encounter the Roaming Legendary 5 times in a row"); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::NO_ERROR_REPORT, "Failed to encounter the Roaming Legendary 5 times in a row", env.console diff --git a/SerialPrograms/Source/PokemonFRLG/Programs/RngManipulation/PokemonFRLG_SidHelper.cpp b/SerialPrograms/Source/PokemonFRLG/Programs/RngManipulation/PokemonFRLG_SidHelper.cpp index 4ddd8fcac8..edd06b38f2 100644 --- a/SerialPrograms/Source/PokemonFRLG/Programs/RngManipulation/PokemonFRLG_SidHelper.cpp +++ b/SerialPrograms/Source/PokemonFRLG/Programs/RngManipulation/PokemonFRLG_SidHelper.cpp @@ -6,7 +6,7 @@ #include #include "CommonFramework/Notifications/ProgramNotifications.h" -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/ProgramStats/StatsTracking.h" #include "CommonTools/Async/InferenceRoutines.h" #include "NintendoSwitch/Commands/NintendoSwitch_Commands_PushButtons.h" @@ -146,7 +146,7 @@ void finish_intro_animations(SingleSwitchProgramEnvironment& env, ProControllerC ); if (ret < 0){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "SidHelper(): black screen not detected within 10 seconds of setting SID", env.console ); } @@ -171,7 +171,7 @@ void navigate_to_trainer_card(SingleSwitchProgramEnvironment& env, ProController int errors = 0; while (true){ if (errors >= 5){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "SidHelper(): failed 5 times to navigate to the Trainer Card", env.console ); } @@ -261,7 +261,7 @@ std::vector> get_sid_messages( void SidHelper::program(SingleSwitchProgramEnvironment& env, ProControllerContext& context){ if (TARGET_ADVANCES % 2 == 0){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::NO_ERROR_REPORT, "SidHelper(): the Target Advances setting needs to be odd", env.console ); } diff --git a/SerialPrograms/Source/PokemonFRLG/Programs/RngManipulation/PokemonFRLG_StarterRng.cpp b/SerialPrograms/Source/PokemonFRLG/Programs/RngManipulation/PokemonFRLG_StarterRng.cpp index aa69a38208..eb55135048 100644 --- a/SerialPrograms/Source/PokemonFRLG/Programs/RngManipulation/PokemonFRLG_StarterRng.cpp +++ b/SerialPrograms/Source/PokemonFRLG/Programs/RngManipulation/PokemonFRLG_StarterRng.cpp @@ -4,7 +4,7 @@ * */ -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/ProgramStats/StatsTracking.h" #include "CommonFramework/Notifications/ProgramNotifications.h" #include "CommonFramework/ProgramStats/StatsTracking.h" @@ -634,7 +634,7 @@ void StarterRng::program(SingleSwitchProgramEnvironment& env, ProControllerConte if (failed_searches >= 5){ env.log("Failed to find any matches 5 times in a row"); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::NO_ERROR_REPORT, "Failed to find any matches 5 times in a row. Check your seed and advances settings.", env.console diff --git a/SerialPrograms/Source/PokemonFRLG/Programs/RngManipulation/PokemonFRLG_WildRng.cpp b/SerialPrograms/Source/PokemonFRLG/Programs/RngManipulation/PokemonFRLG_WildRng.cpp index 693a3ebec0..574ad448b8 100644 --- a/SerialPrograms/Source/PokemonFRLG/Programs/RngManipulation/PokemonFRLG_WildRng.cpp +++ b/SerialPrograms/Source/PokemonFRLG/Programs/RngManipulation/PokemonFRLG_WildRng.cpp @@ -4,7 +4,7 @@ * */ -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/ProgramStats/StatsTracking.h" #include "CommonFramework/Language.h" #include "CommonFramework/Notifications/ProgramNotifications.h" @@ -343,7 +343,7 @@ void WildRng::program(SingleSwitchProgramEnvironment& env, ProControllerContext& TARGET = safari_zone ? PokemonFRLG_RngTarget::safarizonefish : PokemonFRLG_RngTarget::fishing; break; default: - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "WildRng(): Unrecognized encounter type", env.console @@ -409,7 +409,7 @@ void WildRng::program(SingleSwitchProgramEnvironment& env, ProControllerContext& if (failed_searches >= 5){ env.log("Failed to find any matches 5 times in a row"); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::NO_ERROR_REPORT, "Failed to find any matches 5 times in a row. Check your seed and advances settings.", env.console @@ -479,7 +479,7 @@ void WildRng::program(SingleSwitchProgramEnvironment& env, ProControllerContext& env.log("No battle triggered. Resetting..."); continue; }else{ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "WildRng(): Failed to trigger battle", env.console diff --git a/SerialPrograms/Source/PokemonFRLG/Programs/ShinyHunting/PokemonFRLG_GiftReset.cpp b/SerialPrograms/Source/PokemonFRLG/Programs/ShinyHunting/PokemonFRLG_GiftReset.cpp index 90ccba9e21..1d3c7392a9 100644 --- a/SerialPrograms/Source/PokemonFRLG/Programs/ShinyHunting/PokemonFRLG_GiftReset.cpp +++ b/SerialPrograms/Source/PokemonFRLG/Programs/ShinyHunting/PokemonFRLG_GiftReset.cpp @@ -4,7 +4,7 @@ * */ -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/ProgramStats/StatsTracking.h" #include "CommonFramework/Notifications/ProgramNotifications.h" #include "CommonFramework/ProgramStats/StatsTracking.h" @@ -122,7 +122,7 @@ void GiftReset::obtain_pokemon(SingleSwitchProgramEnvironment& env, ProControlle stats.errors++; env.update_stats(); env.log("obtain_pokemon(): Unable to start starter dialog after 10 attempts.", COLOR_RED); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "obtain_pokemon(): Unable to start starter dialog after 10 attempts.", env.console @@ -205,7 +205,7 @@ void GiftReset::obtain_pokemon(SingleSwitchProgramEnvironment& env, ProControlle default: stats.errors++; env.update_stats(); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "obtain_starter(): No recognized state after 10 seconds.", env.console @@ -399,7 +399,7 @@ uint64_t GiftReset::open_summary(SingleSwitchProgramEnvironment& env, ProControl pbf_mash_button(context, BUTTON_B, 10000ms); } } - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "open_summary(): Failed to open party summary after 5 attempts.", env.console @@ -442,7 +442,7 @@ void GiftReset::program(SingleSwitchProgramEnvironment& env, ProControllerContex default: stats.errors++; env.update_stats(); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "GiftReset: Invalid target selection.", env.console diff --git a/SerialPrograms/Source/PokemonFRLG/Programs/ShinyHunting/PokemonFRLG_LegendaryReset.cpp b/SerialPrograms/Source/PokemonFRLG/Programs/ShinyHunting/PokemonFRLG_LegendaryReset.cpp index 5edc218b79..22b91162be 100644 --- a/SerialPrograms/Source/PokemonFRLG/Programs/ShinyHunting/PokemonFRLG_LegendaryReset.cpp +++ b/SerialPrograms/Source/PokemonFRLG/Programs/ShinyHunting/PokemonFRLG_LegendaryReset.cpp @@ -4,7 +4,7 @@ * */ -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/ProgramStats/StatsTracking.h" #include "CommonFramework/Notifications/ProgramNotifications.h" #include "CommonFramework/ProgramStats/StatsTracking.h" @@ -136,7 +136,7 @@ void LegendaryReset::program(SingleSwitchProgramEnvironment& env, ProControllerC stats.errors += soft_reset(env.console, context); continue; #if 0 - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Failed to enter battle.", env.console diff --git a/SerialPrograms/Source/PokemonFRLG/Programs/ShinyHunting/PokemonFRLG_LegendaryRunAway.cpp b/SerialPrograms/Source/PokemonFRLG/Programs/ShinyHunting/PokemonFRLG_LegendaryRunAway.cpp index 55b71ea65d..bf5b59ab5b 100644 --- a/SerialPrograms/Source/PokemonFRLG/Programs/ShinyHunting/PokemonFRLG_LegendaryRunAway.cpp +++ b/SerialPrograms/Source/PokemonFRLG/Programs/ShinyHunting/PokemonFRLG_LegendaryRunAway.cpp @@ -4,7 +4,7 @@ * */ -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/ProgramStats/StatsTracking.h" #include "CommonFramework/Notifications/ProgramNotifications.h" #include "CommonFramework/ProgramStats/StatsTracking.h" @@ -133,7 +133,7 @@ void LegendaryRunAway::reset_hooh(SingleSwitchProgramEnvironment& env, ProContro context.wait_for_all_requests(); if (ret != 0){ env.log("Failed to exit area.", COLOR_RED); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "reset_hooh(): Failed to exit area.", env.console @@ -167,7 +167,7 @@ void LegendaryRunAway::reset_hooh(SingleSwitchProgramEnvironment& env, ProContro context.wait_for_all_requests(); if (ret2 != 0){ env.log("Failed to enter area.", COLOR_RED); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "reset_hooh(): Failed to enter area.", env.console @@ -213,7 +213,7 @@ void LegendaryRunAway::reset_lugia(SingleSwitchProgramEnvironment& env, ProContr context.wait_for_all_requests(); if (ret != 0){ env.log("Failed to exit area.", COLOR_RED); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "reset_lugia(): Failed to exit area.", env.console @@ -246,7 +246,7 @@ void LegendaryRunAway::reset_lugia(SingleSwitchProgramEnvironment& env, ProContr context.wait_for_all_requests(); if (ret2 != 0){ env.log("Failed to enter area.", COLOR_RED); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "reset_lugia(): Failed to enter area.", env.console @@ -335,7 +335,7 @@ void LegendaryRunAway::program(SingleSwitchProgramEnvironment& env, ProControlle reset_lugia(env, context); break; default: - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Invalid target!", env.console diff --git a/SerialPrograms/Source/PokemonFRLG/Programs/ShinyHunting/PokemonFRLG_PrizeCornerReset.cpp b/SerialPrograms/Source/PokemonFRLG/Programs/ShinyHunting/PokemonFRLG_PrizeCornerReset.cpp index 586192a9ff..a85658a939 100644 --- a/SerialPrograms/Source/PokemonFRLG/Programs/ShinyHunting/PokemonFRLG_PrizeCornerReset.cpp +++ b/SerialPrograms/Source/PokemonFRLG/Programs/ShinyHunting/PokemonFRLG_PrizeCornerReset.cpp @@ -4,7 +4,7 @@ * */ -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/ProgramStats/StatsTracking.h" #include "CommonFramework/Notifications/ProgramNotifications.h" #include "CommonFramework/ProgramStats/StatsTracking.h" @@ -159,7 +159,7 @@ void PrizeCornerReset::obtain_prize(SingleSwitchProgramEnvironment& env, ProCont stats.errors++; env.update_stats(); if (attempts >= 5){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "obtain_prize(): Unable to open prize menu after 5 attempts.", env.console diff --git a/SerialPrograms/Source/PokemonFRLG/Programs/ShinyHunting/PokemonFRLG_ShinyHunt-Fishing.cpp b/SerialPrograms/Source/PokemonFRLG/Programs/ShinyHunting/PokemonFRLG_ShinyHunt-Fishing.cpp index 1edf4f02c5..6c1ac09c71 100644 --- a/SerialPrograms/Source/PokemonFRLG/Programs/ShinyHunting/PokemonFRLG_ShinyHunt-Fishing.cpp +++ b/SerialPrograms/Source/PokemonFRLG/Programs/ShinyHunting/PokemonFRLG_ShinyHunt-Fishing.cpp @@ -13,7 +13,7 @@ * - Text speed is set to FAST */ -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/Notifications/ProgramNotifications.h" #include "CommonFramework/ProgramStats/StatsTracking.h" #include "CommonFramework/VideoPipeline/VideoFeed.h" @@ -98,7 +98,7 @@ void ShinyHuntFishing::program( case -1: stats.errors++; env.update_stats(); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "program(): No fish hooked after 5 minutes. Please ensure you are facing water with a rod registered.", env.console diff --git a/SerialPrograms/Source/PokemonHome/Programs/PokemonHome_BoxNavigation.cpp b/SerialPrograms/Source/PokemonHome/Programs/PokemonHome_BoxNavigation.cpp index 9af9a160ae..1405b26535 100644 --- a/SerialPrograms/Source/PokemonHome/Programs/PokemonHome_BoxNavigation.cpp +++ b/SerialPrograms/Source/PokemonHome/Programs/PokemonHome_BoxNavigation.cpp @@ -8,7 +8,7 @@ #include #include #include -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/ImageTools/ImageBoxes.h" #include "CommonFramework/ImageTools/ImageStats.h" #include "CommonFramework/Notifications/ProgramInfo.h" @@ -253,7 +253,7 @@ void read_summary_screen( const int dex_number = summary_reader.read_national_dex(env.console, screen); if (dex_number <= 0 || dex_number > static_cast(NATIONAL_DEX_SLUGS().size())) { - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "BoxSorter Check Summary: Unable to read a correct dex number, found: " + std::to_string(dex_number), env.console diff --git a/SerialPrograms/Source/PokemonHome/Programs/PokemonHome_BoxSorter.cpp b/SerialPrograms/Source/PokemonHome/Programs/PokemonHome_BoxSorter.cpp index aef6e56998..c2ffa23ac3 100644 --- a/SerialPrograms/Source/PokemonHome/Programs/PokemonHome_BoxSorter.cpp +++ b/SerialPrograms/Source/PokemonHome/Programs/PokemonHome_BoxSorter.cpp @@ -29,7 +29,7 @@ language #include #include #include "Common/Cpp/Exceptions.h" -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/ImageTools/ImageStats.h" #include "CommonFramework/Notifications/ProgramNotifications.h" #include "CommonFramework/ProgramStats/StatsTracking.h" @@ -255,7 +255,7 @@ void BoxSorter::program(SingleSwitchProgramEnvironment& env, ProControllerContex context.wait_for_all_requests(); int ret = wait_until(env.console, context, Seconds(5), {summary_screen_watcher}); if (ret != 0){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "HomeBoxSorter(): does not find summary screen after 5 sec", env.console ); } @@ -288,7 +288,7 @@ void BoxSorter::program(SingleSwitchProgramEnvironment& env, ProControllerContex context.wait_for_all_requests(); ret = wait_until(env.console, context, Seconds(5), {box_view_watcher}); if (ret != 0){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "HomeBoxSorter(): does not find box view after 5 sec", env.console ); } diff --git a/SerialPrograms/Source/PokemonHome/Programs/PokemonHome_BoxSorterLivingDex.cpp b/SerialPrograms/Source/PokemonHome/Programs/PokemonHome_BoxSorterLivingDex.cpp index e69a16a7f2..c8b75655f4 100644 --- a/SerialPrograms/Source/PokemonHome/Programs/PokemonHome_BoxSorterLivingDex.cpp +++ b/SerialPrograms/Source/PokemonHome/Programs/PokemonHome_BoxSorterLivingDex.cpp @@ -16,7 +16,7 @@ #include "Common/Cpp/Json/JsonArray.h" #include "Common/Cpp/Json/JsonObject.h" #include "CommonFramework/GlobalAutoPaths.h" -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/Notifications/ProgramNotifications.h" #include "CommonFramework/ProgramStats/StatsTracking.h" #include "CommonFramework/VideoPipeline/VideoOverlay.h" @@ -277,7 +277,7 @@ bool BoxSorterLivingDex::is_viable_for_dex( context.wait_for_all_requests(); int ret = wait_until(env.console, context, Seconds(5), { summary_screen_watcher }); if (ret != 0){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "HomeBoxSorter(): does not find summary screen after 5 sec", env.console ); } @@ -310,7 +310,7 @@ bool BoxSorterLivingDex::is_viable_for_dex( context.wait_for_all_requests(); ret = wait_until(env.console, context, Seconds(5), { box_view_watcher }); if (ret != 0){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "BoxSorterLivingDex(): does not find box view after 5 sec", env.console ); } diff --git a/SerialPrograms/Source/PokemonLA/Programs/Farming/PokemonLA_IngoBattleGrinder.cpp b/SerialPrograms/Source/PokemonLA/Programs/Farming/PokemonLA_IngoBattleGrinder.cpp index 881ba5e529..97249142cb 100644 --- a/SerialPrograms/Source/PokemonLA/Programs/Farming/PokemonLA_IngoBattleGrinder.cpp +++ b/SerialPrograms/Source/PokemonLA/Programs/Farming/PokemonLA_IngoBattleGrinder.cpp @@ -5,7 +5,7 @@ */ #include -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/Notifications/ProgramNotifications.h" #include "CommonFramework/Tools/ErrorDumper.h" #include "CommonFramework/ProgramStats/StatsTracking.h" @@ -139,7 +139,7 @@ bool IngoBattleGrinder::start_dialog(VideoStream& stream, ProControllerContext& // Version 1.1 with new options unlocked. break; default: - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Unable to detect options after 10 A presses.", stream @@ -170,7 +170,7 @@ bool IngoBattleGrinder::start_dialog(VideoStream& stream, ProControllerContext& case 0: return false; default: - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Unable to find opponent list options after 5 A presses.", stream @@ -268,7 +268,7 @@ bool IngoBattleGrinder::run_iteration(SingleSwitchProgramEnvironment& env, ProCo ); if (ret < 0){ env.console.log("Error: Failed to find battle menu after 2 minutes."); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Failed to find battle menu after 2 minutes.", env.console @@ -314,7 +314,7 @@ bool IngoBattleGrinder::run_iteration(SingleSwitchProgramEnvironment& env, ProCo // Pokemon has zero PP on all moves. This should not happen as it will just use // Struggle. env.console.log("No PP on all moves. Abort program.", COLOR_RED); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "No PP on all moves.", env.console diff --git a/SerialPrograms/Source/PokemonLA/Programs/Farming/PokemonLA_IngoMoveGrinder.cpp b/SerialPrograms/Source/PokemonLA/Programs/Farming/PokemonLA_IngoMoveGrinder.cpp index 7483b02ee3..ab0baf8fea 100644 --- a/SerialPrograms/Source/PokemonLA/Programs/Farming/PokemonLA_IngoMoveGrinder.cpp +++ b/SerialPrograms/Source/PokemonLA/Programs/Farming/PokemonLA_IngoMoveGrinder.cpp @@ -4,7 +4,7 @@ * */ -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/Tools/ErrorDumper.h" #include "CommonFramework/Notifications/ProgramNotifications.h" #include "CommonFramework/ProgramStats/StatsTracking.h" @@ -134,7 +134,7 @@ bool IngoMoveGrinder::start_dialog(VideoStream& stream, ProControllerContext& co // Version 1.1 with new options unlocked. break; default: - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Unable to detect options after 10 A presses.", stream @@ -165,7 +165,7 @@ bool IngoMoveGrinder::start_dialog(VideoStream& stream, ProControllerContext& co case 0: return false; default: - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Unable to find opponent list options after 5 A presses.", stream @@ -237,7 +237,7 @@ bool IngoMoveGrinder::run_iteration(SingleSwitchProgramEnvironment& env, ProCont env.console.log("Error: Failed to find battle menu after 2 minutes."); // auto snapshot = env.console.video().snapshot(); // dump_image(env.logger(), env.program_info(), "BattleMenuNotFound", snapshot); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Failed to find battle menu after 2 minutes.", env.console @@ -378,7 +378,7 @@ void IngoMoveGrinder::go_to_next_move(SingleSwitchProgramEnvironment& env, ProCo void IngoMoveGrinder::go_to_next_pokemon(SingleSwitchProgramEnvironment& env, ProControllerContext& context) { if (cur_pokemon == 4){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Abort program. Your 4 first pokemons are done grinding moves, dead or without PP. " "Your fifth pokemon (Arceus) died so no other choice than stopping the program.", diff --git a/SerialPrograms/Source/PokemonLA/Programs/Farming/PokemonLA_LeapGrinder.cpp b/SerialPrograms/Source/PokemonLA/Programs/Farming/PokemonLA_LeapGrinder.cpp index 6956344dfe..c82274cef3 100644 --- a/SerialPrograms/Source/PokemonLA/Programs/Farming/PokemonLA_LeapGrinder.cpp +++ b/SerialPrograms/Source/PokemonLA/Programs/Farming/PokemonLA_LeapGrinder.cpp @@ -5,7 +5,8 @@ */ #include "Common/Cpp/PrettyPrint.h" -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/ErrorReports/ErrorReports.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/Notifications/ProgramNotifications.h" #include "CommonFramework/ProgramStats/StatsTracking.h" #include "CommonFramework/VideoPipeline/VideoFeed.h" @@ -164,7 +165,7 @@ bool LeapGrinder::run_iteration( break; } if (c >= 5){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Failed to switch to Pokemon selection after 5 attempts.", env.console @@ -311,9 +312,19 @@ void LeapGrinder::program(SingleSwitchProgramEnvironment& env, ProControllerCont if(run_iteration(env, context, fresh_from_reset)){ break; } - }catch (OperationFailedException& e){ + }catch (OperationFailedExceptionWithScreenshot& e){ stats.errors++; - e.send_notification(env, NOTIFICATION_ERROR_RECOVERABLE); + send_program_recoverable_error_notification(env, NOTIFICATION_ERROR_RECOVERABLE, e.message(), *e.screenshot()); + if (e.error_report_mode() == ErrorReport::SEND_ERROR_REPORT){ + PokemonAutomation::report_error( + &env.logger(), + env.program_info(), + "Recoverable: OperationFailedExceptionWithScreenshot", + {{"Message:", e.message()}}, + *e.screenshot(), + &e.video_stream()->history() + ); + } pbf_press_button(context, BUTTON_HOME, 160ms, GameSettings::instance().GAME_TO_HOME_DELAY0); fresh_from_reset = reset_game_from_home(env, env.console, context); diff --git a/SerialPrograms/Source/PokemonLA/Programs/Farming/PokemonLA_MagikarpMoveGrinder.cpp b/SerialPrograms/Source/PokemonLA/Programs/Farming/PokemonLA_MagikarpMoveGrinder.cpp index 41397504e2..cea7f8c27d 100644 --- a/SerialPrograms/Source/PokemonLA/Programs/Farming/PokemonLA_MagikarpMoveGrinder.cpp +++ b/SerialPrograms/Source/PokemonLA/Programs/Farming/PokemonLA_MagikarpMoveGrinder.cpp @@ -6,7 +6,7 @@ #include #include -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/Notifications/ProgramNotifications.h" #include "CommonFramework/Tools/ErrorDumper.h" #include "CommonFramework/ProgramStats/StatsTracking.h" @@ -107,7 +107,7 @@ void MagikarpMoveGrinder::grind_mimic(SingleSwitchProgramEnvironment& env, ProCo env.console.log("Error: Failed to find battle menu after 2 minutes."); // auto snapshot = env.console.video().snapshot(); // dump_image(env.logger(), env.program_info(), "BattleMenuNotFound", snapshot); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Failed to find battle menu after 2 minutes.", env.console @@ -178,7 +178,7 @@ void MagikarpMoveGrinder::battle_magikarp(SingleSwitchProgramEnvironment& env, P env.console.log("Error: Failed to find battle menu after 2 minutes."); // auto snapshot = env.console.video().snapshot(); // dump_image(env.logger(), env.program_info(), "BattleMenuNotFound", snapshot); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Failed to find battle menu after 2 minutes.", env.console diff --git a/SerialPrograms/Source/PokemonLA/Programs/Farming/PokemonLA_NuggetFarmerHighlands.cpp b/SerialPrograms/Source/PokemonLA/Programs/Farming/PokemonLA_NuggetFarmerHighlands.cpp index f1d4d04f14..b3156894ae 100644 --- a/SerialPrograms/Source/PokemonLA/Programs/Farming/PokemonLA_NuggetFarmerHighlands.cpp +++ b/SerialPrograms/Source/PokemonLA/Programs/Farming/PokemonLA_NuggetFarmerHighlands.cpp @@ -4,7 +4,8 @@ * */ -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/ErrorReports/ErrorReports.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/Notifications/ProgramNotifications.h" #include "CommonFramework/ProgramStats/StatsTracking.h" #include "CommonTools/Async/InferenceRoutines.h" @@ -232,9 +233,19 @@ void NuggetFarmerHighlands::program(SingleSwitchProgramEnvironment& env, ProCont if (run_iteration(env, context, fresh_from_reset)){ break; } - }catch (OperationFailedException& e){ + }catch (OperationFailedExceptionWithScreenshot& e){ stats.errors++; - e.send_notification(env, NOTIFICATION_ERROR_RECOVERABLE); + send_program_recoverable_error_notification(env, NOTIFICATION_ERROR_RECOVERABLE, e.message(), *e.screenshot()); + if (e.error_report_mode() == ErrorReport::SEND_ERROR_REPORT){ + PokemonAutomation::report_error( + &env.logger(), + env.program_info(), + "Recoverable: OperationFailedExceptionWithScreenshot", + {{"Message:", e.message()}}, + *e.screenshot(), + &e.video_stream()->history() + ); + } pbf_press_button(context, BUTTON_HOME, 160ms, GameSettings::instance().GAME_TO_HOME_DELAY0); fresh_from_reset = reset_game_from_home(env, env.console, context); diff --git a/SerialPrograms/Source/PokemonLA/Programs/Farming/PokemonLA_TenacityCandyFarmer.cpp b/SerialPrograms/Source/PokemonLA/Programs/Farming/PokemonLA_TenacityCandyFarmer.cpp index aef8e129f3..b8d3105725 100644 --- a/SerialPrograms/Source/PokemonLA/Programs/Farming/PokemonLA_TenacityCandyFarmer.cpp +++ b/SerialPrograms/Source/PokemonLA/Programs/Farming/PokemonLA_TenacityCandyFarmer.cpp @@ -5,7 +5,7 @@ */ #include -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/Notifications/ProgramNotifications.h" #include "CommonFramework/ProgramStats/StatsTracking.h" #include "CommonTools/Async/InferenceRoutines.h" @@ -128,7 +128,7 @@ bool TenacityCandyFarmer::run_iteration(SingleSwitchProgramEnvironment& env, Pro } ); if (ret != 0){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Unable to detect Tenacity path menu after 10 A presses.", env.console @@ -207,7 +207,7 @@ bool TenacityCandyFarmer::run_iteration(SingleSwitchProgramEnvironment& env, Pro {{arc_phone_detector}} ); if (ret < 0){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Failed to find Arc phone after 20 seconds when the last battle ends.", env.console @@ -241,7 +241,7 @@ bool TenacityCandyFarmer::run_iteration(SingleSwitchProgramEnvironment& env, Pro if (ret < 0){ env.console.log("Error: Failed to find battle menu after 2 minutes."); // return true; - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Failed to find battle menu after 2 minutes.", env.console diff --git a/SerialPrograms/Source/PokemonLA/Programs/General/PokemonLA_DistortionWaiter.cpp b/SerialPrograms/Source/PokemonLA/Programs/General/PokemonLA_DistortionWaiter.cpp index aecdb510a1..6ff72aa0e9 100644 --- a/SerialPrograms/Source/PokemonLA/Programs/General/PokemonLA_DistortionWaiter.cpp +++ b/SerialPrograms/Source/PokemonLA/Programs/General/PokemonLA_DistortionWaiter.cpp @@ -4,7 +4,7 @@ * */ -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/Notifications/ProgramNotifications.h" #include "CommonFramework/VideoPipeline/VideoFeed.h" #include "CommonFramework/ProgramStats/StatsTracking.h" @@ -113,7 +113,7 @@ void DistortionWaiter::program(SingleSwitchProgramEnvironment& env, ProControlle ); if (ret < 0){ stats.errors++; - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "No distortion found after one hour.", env.console diff --git a/SerialPrograms/Source/PokemonLA/Programs/General/PokemonLA_MMORoutines.cpp b/SerialPrograms/Source/PokemonLA/Programs/General/PokemonLA_MMORoutines.cpp index 8454be7a10..11963718a3 100644 --- a/SerialPrograms/Source/PokemonLA/Programs/General/PokemonLA_MMORoutines.cpp +++ b/SerialPrograms/Source/PokemonLA/Programs/General/PokemonLA_MMORoutines.cpp @@ -6,7 +6,7 @@ * */ -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/ImageTools/ImageBoxes.h" #include "CommonFramework/VideoPipeline/VideoFeed.h" #include "CommonTools/Async/InferenceRoutines.h" @@ -124,7 +124,7 @@ std::set enter_region_and_read_MMO( // Fix zoom level: const int zoom_level = read_map_zoom_level(question_mark_image); if (zoom_level < 0){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Canot read map zoom level.", env.console @@ -188,7 +188,7 @@ std::set enter_region_and_read_MMO( EventDialogDetector event_dialog_detector(env.logger(), env.console.overlay(), true); int ret = wait_until(env.console, context, std::chrono::seconds(10), {{event_dialog_detector}}); if (ret < 0){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Dialog box not detected when waiting for MMO map.", env.console @@ -214,7 +214,7 @@ std::set enter_region_and_read_MMO( env.console.log("Found revealed map thanks to Munchlax!"); break; default: - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Map not detected after talking to Mai.", env.console @@ -227,7 +227,7 @@ std::set enter_region_and_read_MMO( MapDetector map_detector; ret = wait_until(env.console, context, std::chrono::seconds(5), {{map_detector}}); if (ret < 0){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( env.console, ErrorReport::SEND_ERROR_REPORT, "Map not detected after talking to Mai.", true diff --git a/SerialPrograms/Source/PokemonLA/Programs/General/PokemonLA_OutbreakFinder.cpp b/SerialPrograms/Source/PokemonLA/Programs/General/PokemonLA_OutbreakFinder.cpp index 5ede6dabef..9f25228aee 100644 --- a/SerialPrograms/Source/PokemonLA/Programs/General/PokemonLA_OutbreakFinder.cpp +++ b/SerialPrograms/Source/PokemonLA/Programs/General/PokemonLA_OutbreakFinder.cpp @@ -8,7 +8,7 @@ #include "Common/Cpp/Exceptions.h" #include "CommonFramework/StaticGlobals.h" #include "CommonFramework/GlobalAutoPaths.h" -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/ImageTypes/ImageViewRGB32.h" #include "CommonFramework/Notifications/ProgramNotifications.h" #include "CommonFramework/ProgramStats/StatsTracking.h" @@ -342,7 +342,7 @@ void OutbreakFinder::goto_region_and_return( } if (is_wild_land(current_region) == false){ dump_image(env.console.logger(), env.program_info(), "FindRegion", env.console.video().snapshot()); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Unable to find a wild land.", env.console diff --git a/SerialPrograms/Source/PokemonLA/Programs/General/PokemonLA_RamanasIslandCombee.cpp b/SerialPrograms/Source/PokemonLA/Programs/General/PokemonLA_RamanasIslandCombee.cpp index 81ec0a0c57..a5919fe2f4 100644 --- a/SerialPrograms/Source/PokemonLA/Programs/General/PokemonLA_RamanasIslandCombee.cpp +++ b/SerialPrograms/Source/PokemonLA/Programs/General/PokemonLA_RamanasIslandCombee.cpp @@ -6,7 +6,8 @@ #include "CommonFramework/StaticGlobals.h" #include "CommonFramework/Exceptions/ProgramFinishedException.h" -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/ErrorReports/ErrorReports.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/Notifications/ProgramNotifications.h" #include "CommonFramework/ProgramStats/StatsTracking.h" #include "CommonFramework/VideoPipeline/VideoFeed.h" @@ -261,7 +262,7 @@ void RamanasCombeeFinder::run_iteration( break; } if (c >= 5){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Failed to switch to Pokemon selection after 5 attempts.", env.console @@ -314,7 +315,7 @@ void RamanasCombeeFinder::run_iteration( pbf_press_button(context, BUTTON_CAPTURE, 2000ms, 2000ms); context.wait_for_all_requests(); } - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Black out.", env.console @@ -336,9 +337,19 @@ void RamanasCombeeFinder::program(SingleSwitchProgramEnvironment& env, ProContro send_program_status_notification(env, NOTIFICATION_STATUS); try{ run_iteration(env, context, fresh_from_reset); - }catch (OperationFailedException& e){ + }catch (OperationFailedExceptionWithScreenshot& e){ stats.errors++; - e.send_notification(env, NOTIFICATION_ERROR_RECOVERABLE); + send_program_recoverable_error_notification(env, NOTIFICATION_ERROR_RECOVERABLE, e.message(), *e.screenshot()); + if (e.error_report_mode() == ErrorReport::SEND_ERROR_REPORT){ + PokemonAutomation::report_error( + &env.logger(), + env.program_info(), + "Recoverable: OperationFailedExceptionWithScreenshot", + {{"Message:", e.message()}}, + *e.screenshot(), + &e.video_stream()->history() + ); + } pbf_press_button(context, BUTTON_HOME, 160ms, GameSettings::instance().GAME_TO_HOME_DELAY0); fresh_from_reset = reset_game_from_home(env, env.console, context); diff --git a/SerialPrograms/Source/PokemonLA/Programs/General/PokemonLA_SkipToFullMoon.cpp b/SerialPrograms/Source/PokemonLA/Programs/General/PokemonLA_SkipToFullMoon.cpp index 16176857e1..281e4c5c41 100644 --- a/SerialPrograms/Source/PokemonLA/Programs/General/PokemonLA_SkipToFullMoon.cpp +++ b/SerialPrograms/Source/PokemonLA/Programs/General/PokemonLA_SkipToFullMoon.cpp @@ -4,7 +4,7 @@ * */ -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/Notifications/ProgramNotifications.h" #include "CommonFramework/VideoPipeline/VideoFeed.h" #include "CommonTools/Async/InferenceRoutines.h" @@ -58,7 +58,7 @@ void SkipToFullMoon::program(SingleSwitchProgramEnvironment& env, ProControllerC const auto compatibility = detect_item_compatibility(env.console.video().snapshot()); if (compatibility == ItemCompatibility::NONE){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Unable to detect item compatibility.", env.console diff --git a/SerialPrograms/Source/PokemonLA/Programs/ML/PokemonLA_GeneratePokemonImageTrainingData.cpp b/SerialPrograms/Source/PokemonLA/Programs/ML/PokemonLA_GeneratePokemonImageTrainingData.cpp index fcfe4086fb..3bb4be538f 100644 --- a/SerialPrograms/Source/PokemonLA/Programs/ML/PokemonLA_GeneratePokemonImageTrainingData.cpp +++ b/SerialPrograms/Source/PokemonLA/Programs/ML/PokemonLA_GeneratePokemonImageTrainingData.cpp @@ -5,7 +5,7 @@ */ #include "Common/Cpp/Exceptions.h" -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/Exceptions/ProgramFinishedException.h" #include "CommonFramework/Exceptions/ScreenshotException.h" #include "CommonFramework/ImageTools/ImageStats.h" @@ -129,7 +129,7 @@ void GeneratePokemonImageTrainingData::program(SingleSwitchProgramEnvironment& e throw; }catch (ScreenshotException& e){ std::string fail_message = e.message(); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, fail_message, env.console diff --git a/SerialPrograms/Source/PokemonLA/Programs/PokemonLA_BattleRoutines.cpp b/SerialPrograms/Source/PokemonLA/Programs/PokemonLA_BattleRoutines.cpp index bd95ba0dba..c2b0eac26c 100644 --- a/SerialPrograms/Source/PokemonLA/Programs/PokemonLA_BattleRoutines.cpp +++ b/SerialPrograms/Source/PokemonLA/Programs/PokemonLA_BattleRoutines.cpp @@ -4,7 +4,7 @@ * */ -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/VideoPipeline/VideoFeed.h" #include "CommonTools/Async/InferenceRoutines.h" #include "CommonTools/VisualDetectors/ImageMatchDetector.h" @@ -33,7 +33,7 @@ void mash_A_until_end_of_battle(VideoStream& stream, ProControllerContext& conte {{detector}} ); if (ret < 0){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Failed to return to overworld after 3 minutes.", stream @@ -50,7 +50,7 @@ size_t switch_pokemon( size_t max_num_pokemon ){ if (pokemon_to_switch_to >= max_num_pokemon){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Cannot send any more Pokemon to battle, max: " + std::to_string(max_num_pokemon), stream @@ -80,7 +80,7 @@ size_t switch_pokemon( // and therefore cannot be used. Try the next pokemon: pokemon_to_switch_to++; if (pokemon_to_switch_to >= max_num_pokemon){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Cannot send any more Pokemon to battle, max: " + std::to_string(max_num_pokemon), stream @@ -178,7 +178,7 @@ void use_next_move_with_pp( // Pokemon has zero PP on all moves. This should not happen as it will just use // Struggle. stream.log("No PP on all moves. Abort program.", COLOR_RED); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "No PP on all moves.", stream diff --git a/SerialPrograms/Source/PokemonLA/Programs/PokemonLA_FlagNavigationAir.cpp b/SerialPrograms/Source/PokemonLA/Programs/PokemonLA_FlagNavigationAir.cpp index 1e1019f737..6ac45c1c08 100644 --- a/SerialPrograms/Source/PokemonLA/Programs/PokemonLA_FlagNavigationAir.cpp +++ b/SerialPrograms/Source/PokemonLA/Programs/PokemonLA_FlagNavigationAir.cpp @@ -5,7 +5,7 @@ */ #include -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/Tools/ErrorDumper.h" #include "CommonTools/Async/InterruptableCommands.h" #include "NintendoSwitch/Commands/NintendoSwitch_Commands_PushButtons.h" @@ -305,28 +305,28 @@ void FlagNavigationAir::set_distance_callback(std::function& commands, WallClock timestamp){ if (last_state_change() + std::chrono::seconds(60) < timestamp){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "No state change detected after 60 seconds.", m_stream ); } if (start_time() + m_navigate_timeout < timestamp){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Unable to reach flag after timeout period.", m_stream ); } if (m_dialog_detector.detected()){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::NO_ERROR_REPORT, "Potential ambush by Miss Fortune sister.", m_stream ); } if (m_find_flag_failed.load(std::memory_order_acquire)){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::NO_ERROR_REPORT, "Unable to find flag.", m_stream @@ -449,7 +449,7 @@ bool FlagNavigationAir::run_flying(AsyncCommandSession& commands, #endif // if (m_last_flag_detection + std::chrono::seconds(20) < timestamp){ -// OperationFailedException::fire(m_console, "Flag not detected after 20 seconds.", true); +// OperationFailedExceptionWithScreenshot::fire(m_console, "Flag not detected after 20 seconds.", true); // } // double flag_age = std::chrono::duration_cast(timestamp - m_last_flag_detection).count() / 1000.; // if (flag_age > 0){ diff --git a/SerialPrograms/Source/PokemonLA/Programs/PokemonLA_GameSave.cpp b/SerialPrograms/Source/PokemonLA/Programs/PokemonLA_GameSave.cpp index f130d00298..3224c69ae6 100644 --- a/SerialPrograms/Source/PokemonLA/Programs/PokemonLA_GameSave.cpp +++ b/SerialPrograms/Source/PokemonLA/Programs/PokemonLA_GameSave.cpp @@ -6,7 +6,7 @@ #include "Common/Cpp/TestRunners/UnitTestDatabase.h" #include "CommonFramework/GlobalAutoPaths.h" -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/ImageTools/ImageStats.h" #include "CommonFramework/ImageTypes/ImageViewRGB32.h" #include "CommonFramework/ImageTypes/ImageRGB32.h" @@ -93,7 +93,7 @@ bool save_game_from_overworld( snapshot = stream.video().snapshot(); } if (!found){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Unable to find save menu.", stream @@ -111,7 +111,7 @@ bool save_game_from_overworld( {detector} ); if (ret < 0){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Unable to return to overworld.", stream diff --git a/SerialPrograms/Source/PokemonLA/Programs/PokemonLA_MountChange.cpp b/SerialPrograms/Source/PokemonLA/Programs/PokemonLA_MountChange.cpp index 138dd67300..24a0d0ded6 100644 --- a/SerialPrograms/Source/PokemonLA/Programs/PokemonLA_MountChange.cpp +++ b/SerialPrograms/Source/PokemonLA/Programs/PokemonLA_MountChange.cpp @@ -4,7 +4,7 @@ * */ -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/VideoPipeline/VideoFeed.h" #include "NintendoSwitch/Commands/NintendoSwitch_Commands_PushButtons.h" #include "PokemonLA_MountChange.h" @@ -100,7 +100,7 @@ void change_mount(VideoStream& stream, ProControllerContext& context, MountState } } - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, std::string("Unable to find ") + MOUNT_STATE_STRINGS[(size_t)mount] + " after 10 attempts.", stream @@ -134,7 +134,7 @@ void dismount(VideoStream& stream, ProControllerContext& context){ pbf_press_button(context, BUTTON_PLUS, 160ms, 840ms); } - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Unable to dismount after 10 attempts.", stream diff --git a/SerialPrograms/Source/PokemonLA/Programs/PokemonLA_RegionNavigation.cpp b/SerialPrograms/Source/PokemonLA/Programs/PokemonLA_RegionNavigation.cpp index 54e2181498..38edfb2b03 100644 --- a/SerialPrograms/Source/PokemonLA/Programs/PokemonLA_RegionNavigation.cpp +++ b/SerialPrograms/Source/PokemonLA/Programs/PokemonLA_RegionNavigation.cpp @@ -5,7 +5,7 @@ */ #include "Common/Cpp/Exceptions.h" -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/Tools/ErrorDumper.h" #include "CommonFramework/Tools/ProgramEnvironment.h" #include "CommonTools/Async/InferenceRoutines.h" @@ -117,7 +117,7 @@ void from_professor_return_to_jubilife( pbf_mash_button(context, BUTTON_B, 160ms); break; default: - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Did not detect option to return to Jubilife.", stream @@ -139,7 +139,7 @@ void mash_A_to_enter_sub_area( {{black_screen0}} ); if (ret < 0){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Failed to load into sub area after 7 seconds.", stream @@ -167,7 +167,7 @@ void mash_A_to_change_region( {{black_screen0}} ); if (ret < 0){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( stream, ErrorReport::SEND_ERROR_REPORT, "Failed to load into region after timeout." ); @@ -190,7 +190,7 @@ void mash_A_to_change_region( } ); if (ret < 0){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Failed to load into region after timeout.", stream @@ -206,7 +206,7 @@ void mash_A_to_change_region( {phone} ); if (ret < 0){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Failed to load into region after timeout.", stream @@ -242,7 +242,7 @@ void open_travel_map_from_jubilife( "Make sure you save your game in Jubilife with your back facing the gate." ); }else{ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Map not detected after 10 x A presses.", stream @@ -266,7 +266,7 @@ void goto_camp_from_jubilife( DpadPosition direction = location.region < MapRegion::HIGHLANDS ? DPAD_RIGHT : DPAD_LEFT; if (location.region == MapRegion::JUBILIFE){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, std::string("Should not choose Jubilife Village as destination when leaving camp"), stream @@ -284,7 +284,7 @@ void goto_camp_from_jubilife( context.wait_for_all_requests(); } if (current_region != location.region){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, std::string("Unable to find: ") + location.display, stream @@ -320,7 +320,7 @@ void goto_camp_from_jubilife( {{detector}} ); if (ret < 0){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Map not detected after 5 seconds.", stream @@ -345,7 +345,7 @@ void goto_camp_from_jubilife( {{detector}} ); if (ret < 0){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Unable to fly. Are you under attack?", stream @@ -366,7 +366,7 @@ void goto_camp_from_jubilife( {{black_screen}} ); if (ret < 0){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Failed to fly to camp after 20 seconds.", stream @@ -401,7 +401,7 @@ void goto_camp_from_overworld( } if (current_time() - start > std::chrono::seconds(60)){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::NO_ERROR_REPORT, "Unable to escape from being attacked.", stream @@ -462,7 +462,7 @@ void goto_camp_from_overworld( {{black_screen}} ); if (ret < 0){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Failed to fly to camp after 20 seconds.", stream @@ -489,7 +489,7 @@ void fast_travel_from_overworld( } if (current_time() - start > std::chrono::seconds(60)){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::NO_ERROR_REPORT, "Unable to escape from being attacked.", stream @@ -506,7 +506,7 @@ void fast_travel_from_overworld( {{detector}} ); if (ret < 0){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Map not detected after 5 seconds.", stream @@ -557,7 +557,7 @@ void fast_travel_from_overworld( {{black_screen}} ); if (ret < 0){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Failed to fly to camp after 20 seconds.", stream diff --git a/SerialPrograms/Source/PokemonLA/Programs/PokemonLA_TimeOfDayChange.cpp b/SerialPrograms/Source/PokemonLA/Programs/PokemonLA_TimeOfDayChange.cpp index 7160746a44..5ee490a757 100644 --- a/SerialPrograms/Source/PokemonLA/Programs/PokemonLA_TimeOfDayChange.cpp +++ b/SerialPrograms/Source/PokemonLA/Programs/PokemonLA_TimeOfDayChange.cpp @@ -4,7 +4,7 @@ * */ -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/VideoPipeline/VideoOverlay.h" #include "CommonTools/Async/InferenceRoutines.h" #include "NintendoSwitch/Commands/NintendoSwitch_Commands_PushButtons.h" @@ -87,7 +87,7 @@ void change_time_of_day_at_tent( stream, context, std::chrono::seconds(5), {{yellow_arrow_detector}} ); if (ret < 0){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Did not interact with a tent.", stream @@ -120,7 +120,7 @@ void change_time_of_day_at_tent( stream, context, std::chrono::seconds(30), {{yellow_arrow_detector}} ); if (ret < 0){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Failed to stand up after resting in a tent.", stream diff --git a/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_AutoMultiSpawn.cpp b/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_AutoMultiSpawn.cpp index b6e2d8dcf2..9d72d1c8a6 100644 --- a/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_AutoMultiSpawn.cpp +++ b/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_AutoMultiSpawn.cpp @@ -10,7 +10,7 @@ #include #include #include "CommonFramework/StaticGlobals.h" -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/Notifications/ProgramNotifications.h" #include "CommonFramework/VideoPipeline/VideoFeed.h" #include "CommonFramework/Tools/DebugDumper.h" @@ -344,7 +344,7 @@ void AutoMultiSpawn::advance_one_path_step( break; } if (c >= 5){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Failed to switch to Pokemon selection after 5 attempts.", env.console, @@ -370,7 +370,7 @@ void AutoMultiSpawn::advance_one_path_step( + std::to_string(already_removed_pokemon) + " pokemon removed, target total pokemon to remove: " + std::to_string(num_to_despawn) ); if (already_removed_pokemon > num_to_despawn){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Removed more pokemon than required. Removed " + std::to_string(already_removed_pokemon) + " while target is " + std::to_string(num_to_despawn), @@ -390,7 +390,7 @@ void AutoMultiSpawn::advance_one_path_step( } } if (remained_to_remove > 0){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "After trying to start three battles, cannot remove enough pokemon.", env.console @@ -429,7 +429,7 @@ size_t AutoMultiSpawn::try_one_battle_to_remove_pokemon( } if (focused_pokemon.name_candidates.size() == 0){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Cannot focus on a pokemon after going to the spawn point " + std::to_string(num_tries) + " times", env.console @@ -471,7 +471,7 @@ size_t AutoMultiSpawn::try_one_battle_to_remove_pokemon( ); if (ret < 0){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Cannot detect a battle after 30 seconds.", env.console @@ -526,7 +526,7 @@ size_t AutoMultiSpawn::try_one_battle_to_remove_pokemon( // Oh no, we removed more than needed. // XXX can try to reset the game to fix this. But for now let user handles this. env.log("Removed more than needed!"); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Removed more pokemon than needed!", env.console @@ -552,7 +552,7 @@ size_t AutoMultiSpawn::try_one_battle_to_remove_pokemon( env.console, context, std::chrono::seconds(30), {{escape_detector}} ); if (ret < 0){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Cannot detect end of battle when escaping.", env.console diff --git a/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_BurmyFinder.cpp b/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_BurmyFinder.cpp index 0389da3fb6..e666ea1af2 100644 --- a/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_BurmyFinder.cpp +++ b/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_BurmyFinder.cpp @@ -8,7 +8,8 @@ #include #include "Common/Cpp/PrettyPrint.h" #include "CommonFramework/StaticGlobals.h" -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/ErrorReports/ErrorReports.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/Notifications/ProgramNotifications.h" #include "CommonFramework/ProgramStats/StatsTracking.h" #include "CommonFramework/VideoPipeline/VideoFeed.h" @@ -753,7 +754,7 @@ void BurmyFinder::run_iteration( break; } if (c >= 5){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Failed to switch to Pokemon selection after 5 attempts.", env.console, @@ -813,7 +814,7 @@ void BurmyFinder::run_iteration( pbf_press_button(context, BUTTON_CAPTURE, 2000ms, 2000ms); context.wait_for_all_requests(); } - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Black out.", env.console @@ -838,9 +839,19 @@ void BurmyFinder::program(SingleSwitchProgramEnvironment& env, ProControllerCont send_program_status_notification(env, NOTIFICATION_STATUS); try{ run_iteration(env, context, counters, fresh_from_reset); - }catch (OperationFailedException& e){ + }catch (OperationFailedExceptionWithScreenshot& e){ stats.errors++; - e.send_notification(env, NOTIFICATION_ERROR_RECOVERABLE); + send_program_recoverable_error_notification(env, NOTIFICATION_ERROR_RECOVERABLE, e.message(), *e.screenshot()); + if (e.error_report_mode() == ErrorReport::SEND_ERROR_REPORT){ + PokemonAutomation::report_error( + &env.logger(), + env.program_info(), + "Recoverable: OperationFailedExceptionWithScreenshot", + {{"Message:", e.message()}}, + *e.screenshot(), + &e.video_stream()->history() + ); + } pbf_press_button(context, BUTTON_HOME, 160ms, GameSettings::instance().GAME_TO_HOME_DELAY0); fresh_from_reset = reset_game_from_home( diff --git a/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_CrobatFinder.cpp b/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_CrobatFinder.cpp index 8dd6d6ea03..97a74f7589 100644 --- a/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_CrobatFinder.cpp +++ b/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_CrobatFinder.cpp @@ -4,7 +4,8 @@ * */ -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/ErrorReports/ErrorReports.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/Notifications/ProgramNotifications.h" #include "CommonFramework/ProgramStats/StatsTracking.h" #include "CommonFramework/VideoPipeline/VideoFeed.h" @@ -121,7 +122,7 @@ void CrobatFinder::run_iteration(SingleSwitchProgramEnvironment& env, ProControl context.wait_for_all_requests(); } if (error){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Unable to find Wyrdeer after 10 attempts.", env.console @@ -197,9 +198,19 @@ void CrobatFinder::program(SingleSwitchProgramEnvironment& env, ProControllerCon send_program_status_notification(env, NOTIFICATION_STATUS); try{ run_iteration(env, context); - }catch (OperationFailedException& e){ + }catch (OperationFailedExceptionWithScreenshot& e){ stats.errors++; - e.send_notification(env, NOTIFICATION_ERROR_RECOVERABLE); + send_program_recoverable_error_notification(env, NOTIFICATION_ERROR_RECOVERABLE, e.message(), *e.screenshot()); + if (e.error_report_mode() == ErrorReport::SEND_ERROR_REPORT){ + PokemonAutomation::report_error( + &env.logger(), + env.program_info(), + "Recoverable: OperationFailedExceptionWithScreenshot", + {{"Message:", e.message()}}, + *e.screenshot(), + &e.video_stream()->history() + ); + } pbf_press_button(context, BUTTON_HOME, 160ms, GameSettings::instance().GAME_TO_HOME_DELAY0); reset_game_from_home(env, env.console, context); diff --git a/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_FroslassFinder.cpp b/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_FroslassFinder.cpp index 928671d228..4dff303dc4 100644 --- a/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_FroslassFinder.cpp +++ b/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_FroslassFinder.cpp @@ -4,7 +4,8 @@ * */ -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/ErrorReports/ErrorReports.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/Notifications/ProgramNotifications.h" #include "CommonFramework/ProgramStats/StatsTracking.h" #include "CommonTools/Async/InferenceRoutines.h" @@ -186,9 +187,19 @@ void FroslassFinder::program(SingleSwitchProgramEnvironment& env, ProControllerC send_program_status_notification(env, NOTIFICATION_STATUS); try{ run_iteration(env, context, fresh_from_reset); - }catch (OperationFailedException& e){ + }catch (OperationFailedExceptionWithScreenshot& e){ stats.errors++; - e.send_notification(env, NOTIFICATION_ERROR_RECOVERABLE); + send_program_recoverable_error_notification(env, NOTIFICATION_ERROR_RECOVERABLE, e.message(), *e.screenshot()); + if (e.error_report_mode() == ErrorReport::SEND_ERROR_REPORT){ + PokemonAutomation::report_error( + &env.logger(), + env.program_info(), + "Recoverable: OperationFailedExceptionWithScreenshot", + {{"Message:", e.message()}}, + *e.screenshot(), + &e.video_stream()->history() + ); + } pbf_press_button(context, BUTTON_HOME, 160ms, GameSettings::instance().GAME_TO_HOME_DELAY0); fresh_from_reset = reset_game_from_home( diff --git a/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_GalladeFinder.cpp b/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_GalladeFinder.cpp index 61180117df..15fcb4813d 100644 --- a/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_GalladeFinder.cpp +++ b/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_GalladeFinder.cpp @@ -4,7 +4,8 @@ * */ -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/ErrorReports/ErrorReports.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/Notifications/ProgramNotifications.h" #include "CommonFramework/ProgramStats/StatsTracking.h" #include "CommonTools/Async/InferenceRoutines.h" @@ -180,9 +181,19 @@ void GalladeFinder::program(SingleSwitchProgramEnvironment& env, ProControllerCo send_program_status_notification(env, NOTIFICATION_STATUS); try{ run_iteration(env, context); - }catch (OperationFailedException& e){ + }catch (OperationFailedExceptionWithScreenshot& e){ stats.errors++; - e.send_notification(env, NOTIFICATION_ERROR_RECOVERABLE); + send_program_recoverable_error_notification(env, NOTIFICATION_ERROR_RECOVERABLE, e.message(), *e.screenshot()); + if (e.error_report_mode() == ErrorReport::SEND_ERROR_REPORT){ + PokemonAutomation::report_error( + &env.logger(), + env.program_info(), + "Recoverable: OperationFailedExceptionWithScreenshot", + {{"Message:", e.message()}}, + *e.screenshot(), + &e.video_stream()->history() + ); + } pbf_press_button(context, BUTTON_HOME, 160ms, GameSettings::instance().GAME_TO_HOME_DELAY0); reset_game_from_home(env, env.console, context); diff --git a/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_PostMMOSpawnReset.cpp b/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_PostMMOSpawnReset.cpp index 6253bd9910..e9105f326c 100644 --- a/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_PostMMOSpawnReset.cpp +++ b/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_PostMMOSpawnReset.cpp @@ -4,7 +4,8 @@ * */ -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/ErrorReports/ErrorReports.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/Notifications/ProgramNotifications.h" #include "CommonFramework/ProgramStats/StatsTracking.h" #include "CommonTools/Async/InferenceRoutines.h" @@ -151,9 +152,19 @@ void PostMMOSpawnReset::program(SingleSwitchProgramEnvironment& env, ProControll send_program_status_notification(env, NOTIFICATION_STATUS); try{ run_iteration(env, context); - }catch (OperationFailedException& e){ + }catch (OperationFailedExceptionWithScreenshot& e){ stats.errors++; - e.send_notification(env, NOTIFICATION_ERROR_RECOVERABLE); + send_program_recoverable_error_notification(env, NOTIFICATION_ERROR_RECOVERABLE, e.message(), *e.screenshot()); + if (e.error_report_mode() == ErrorReport::SEND_ERROR_REPORT){ + PokemonAutomation::report_error( + &env.logger(), + env.program_info(), + "Recoverable: OperationFailedExceptionWithScreenshot", + {{"Message:", e.message()}}, + *e.screenshot(), + &e.video_stream()->history() + ); + } // run_iteration() restarts the game first then listens to shiny sound. // If there is any error generated when the game is running and is caught here, diff --git a/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_ShinyHunt-CustomPath.cpp b/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_ShinyHunt-CustomPath.cpp index df17e652f4..6e772f672a 100644 --- a/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_ShinyHunt-CustomPath.cpp +++ b/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_ShinyHunt-CustomPath.cpp @@ -4,7 +4,8 @@ * */ -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/ErrorReports/ErrorReports.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/Notifications/ProgramNotifications.h" #include "CommonFramework/ProgramStats/StatsTracking.h" #include "CommonTools/Async/InferenceRoutines.h" @@ -310,9 +311,19 @@ void ShinyHuntCustomPath::program(SingleSwitchProgramEnvironment& env, ProContro from_professor_return_to_jubilife(env, env.console, context); } - }catch (OperationFailedException& e){ + }catch (OperationFailedExceptionWithScreenshot& e){ stats.errors++; - e.send_notification(env, NOTIFICATION_ERROR_RECOVERABLE); + send_program_recoverable_error_notification(env, NOTIFICATION_ERROR_RECOVERABLE, e.message(), *e.screenshot()); + if (e.error_report_mode() == ErrorReport::SEND_ERROR_REPORT){ + PokemonAutomation::report_error( + &env.logger(), + env.program_info(), + "Recoverable: OperationFailedExceptionWithScreenshot", + {{"Message:", e.message()}}, + *e.screenshot(), + &e.video_stream()->history() + ); + } time_reset_run_count = 0; pbf_press_button(context, BUTTON_HOME, 160ms, GameSettings::instance().GAME_TO_HOME_DELAY0); diff --git a/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_ShinyHunt-FlagPin.cpp b/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_ShinyHunt-FlagPin.cpp index be985925c0..9058ae1e4b 100644 --- a/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_ShinyHunt-FlagPin.cpp +++ b/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_ShinyHunt-FlagPin.cpp @@ -4,7 +4,8 @@ * */ -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/ErrorReports/ErrorReports.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/Notifications/ProgramNotifications.h" #include "CommonFramework/ProgramStats/StatsTracking.h" #include "CommonTools/Async/InferenceRoutines.h" @@ -199,9 +200,19 @@ void ShinyHuntFlagPin::program(SingleSwitchProgramEnvironment& env, ProControlle send_program_status_notification(env, NOTIFICATION_STATUS); try{ run_iteration(env, context, fresh_from_reset); - }catch (OperationFailedException& e){ + }catch (OperationFailedExceptionWithScreenshot& e){ stats.errors++; - e.send_notification(env, NOTIFICATION_ERROR_RECOVERABLE); + send_program_recoverable_error_notification(env, NOTIFICATION_ERROR_RECOVERABLE, e.message(), *e.screenshot()); + if (e.error_report_mode() == ErrorReport::SEND_ERROR_REPORT){ + PokemonAutomation::report_error( + &env.logger(), + env.program_info(), + "Recoverable: OperationFailedExceptionWithScreenshot", + {{"Message:", e.message()}}, + *e.screenshot(), + &e.video_stream()->history() + ); + } pbf_press_button(context, BUTTON_HOME, 160ms, GameSettings::instance().GAME_TO_HOME_DELAY0); fresh_from_reset = reset_game_from_home(env, env.console, context); diff --git a/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_ShinyHunt-LakeTrio.cpp b/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_ShinyHunt-LakeTrio.cpp index a729d987bb..b1223db7f3 100644 --- a/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_ShinyHunt-LakeTrio.cpp +++ b/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_ShinyHunt-LakeTrio.cpp @@ -5,7 +5,7 @@ */ #include -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/ImageTypes/ImageViewRGB32.h" #include "CommonFramework/Notifications/ProgramNotifications.h" #include "CommonFramework/VideoPipeline/VideoFeed.h" @@ -172,7 +172,7 @@ void ShinyHuntLakeTrio::program(SingleSwitchProgramEnvironment& env, ProControll ); consecutive_errors++; if (consecutive_errors >= 3){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Failed to detect an encounter 3 times in the row.", env.console diff --git a/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_UnownFinder.cpp b/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_UnownFinder.cpp index d164d2689f..4f351572bb 100644 --- a/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_UnownFinder.cpp +++ b/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_UnownFinder.cpp @@ -4,7 +4,8 @@ * */ -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/ErrorReports/ErrorReports.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/Notifications/ProgramNotifications.h" #include "CommonFramework/ProgramStats/StatsTracking.h" #include "CommonTools/Async/InferenceRoutines.h" @@ -185,9 +186,19 @@ void UnownFinder::program(SingleSwitchProgramEnvironment& env, ProControllerCont send_program_status_notification(env, NOTIFICATION_STATUS); try{ run_iteration(env, context, fresh_from_reset); - }catch (OperationFailedException& e){ + }catch (OperationFailedExceptionWithScreenshot& e){ stats.errors++; - e.send_notification(env, NOTIFICATION_ERROR_RECOVERABLE); + send_program_recoverable_error_notification(env, NOTIFICATION_ERROR_RECOVERABLE, e.message(), *e.screenshot()); + if (e.error_report_mode() == ErrorReport::SEND_ERROR_REPORT){ + PokemonAutomation::report_error( + &env.logger(), + env.program_info(), + "Recoverable: OperationFailedExceptionWithScreenshot", + {{"Message:", e.message()}}, + *e.screenshot(), + &e.video_stream()->history() + ); + } pbf_press_button(context, BUTTON_HOME, 160ms, GameSettings::instance().GAME_TO_HOME_DELAY0); fresh_from_reset = reset_game_from_home( diff --git a/SerialPrograms/Source/PokemonLGPE/Programs/PokemonLGPE_GameEntry.cpp b/SerialPrograms/Source/PokemonLGPE/Programs/PokemonLGPE_GameEntry.cpp index 3d319ddbf1..7702a49376 100644 --- a/SerialPrograms/Source/PokemonLGPE/Programs/PokemonLGPE_GameEntry.cpp +++ b/SerialPrograms/Source/PokemonLGPE/Programs/PokemonLGPE_GameEntry.cpp @@ -7,7 +7,7 @@ //#include "CommonFramework/VideoPipeline/VideoFeed.h" #include "CommonFramework/Tools/ErrorDumper.h" #include "CommonFramework/Tools/ProgramEnvironment.h" -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonTools/Async/InferenceRoutines.h" #include "CommonTools/VisualDetectors/BlackScreenDetector.h" //#include "Controllers/ControllerTypes.h" @@ -126,7 +126,7 @@ bool reset_game_from_home( ){ if (dynamic_cast(&context.controller()) == nullptr){ console.log("Right Joycon required!", COLOR_RED); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "reset_game_from_home(): Right Joycon required.", console diff --git a/SerialPrograms/Source/PokemonLGPE/Programs/ShinyHunting/PokemonLGPE_AlolanTrade.cpp b/SerialPrograms/Source/PokemonLGPE/Programs/ShinyHunting/PokemonLGPE_AlolanTrade.cpp index 86e0a89b07..81df5e3a5a 100644 --- a/SerialPrograms/Source/PokemonLGPE/Programs/ShinyHunting/PokemonLGPE_AlolanTrade.cpp +++ b/SerialPrograms/Source/PokemonLGPE/Programs/ShinyHunting/PokemonLGPE_AlolanTrade.cpp @@ -4,7 +4,7 @@ * */ -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/Notifications/ProgramNotifications.h" #include "CommonFramework/ProgramStats/StatsTracking.h" #include "CommonFramework/VideoPipeline/VideoFeed.h" @@ -96,7 +96,7 @@ void AlolanTrade::run_trade(SingleSwitchProgramEnvironment& env, JoyconContext& env.log("Failed to start trade.", COLOR_RED); stats.errors++; env.update_stats(); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Failed to start trade.", env.console @@ -117,7 +117,7 @@ void AlolanTrade::run_trade(SingleSwitchProgramEnvironment& env, JoyconContext& stats.errors++; env.update_stats(); env.log("Did not detect end of trade.", COLOR_RED); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Did not detect end of trade.", env.console diff --git a/SerialPrograms/Source/PokemonLGPE/Programs/ShinyHunting/PokemonLGPE_FossilRevival.cpp b/SerialPrograms/Source/PokemonLGPE/Programs/ShinyHunting/PokemonLGPE_FossilRevival.cpp index 1b20c3377b..2dadc09684 100644 --- a/SerialPrograms/Source/PokemonLGPE/Programs/ShinyHunting/PokemonLGPE_FossilRevival.cpp +++ b/SerialPrograms/Source/PokemonLGPE/Programs/ShinyHunting/PokemonLGPE_FossilRevival.cpp @@ -4,7 +4,7 @@ * */ -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/Notifications/ProgramNotifications.h" #include "CommonFramework/ProgramStats/StatsTracking.h" #include "CommonFramework/VideoPipeline/VideoFeed.h" @@ -128,7 +128,7 @@ void FossilRevival::run_revives(SingleSwitchProgramEnvironment& env, JoyconConte stats.errors++; env.update_stats(); env.log("Failed to revive fossil.", COLOR_RED); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Failed to revive fossil.", env.console @@ -151,7 +151,7 @@ void FossilRevival::run_revives(SingleSwitchProgramEnvironment& env, JoyconConte stats.errors++; env.update_stats(); env.log("Did not detect summary over.", COLOR_RED); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Did not detect summary over.", env.console diff --git a/SerialPrograms/Source/PokemonLGPE/Programs/ShinyHunting/PokemonLGPE_GiftReset.cpp b/SerialPrograms/Source/PokemonLGPE/Programs/ShinyHunting/PokemonLGPE_GiftReset.cpp index 37475d6158..9ef6420c23 100644 --- a/SerialPrograms/Source/PokemonLGPE/Programs/ShinyHunting/PokemonLGPE_GiftReset.cpp +++ b/SerialPrograms/Source/PokemonLGPE/Programs/ShinyHunting/PokemonLGPE_GiftReset.cpp @@ -4,7 +4,7 @@ * */ -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/Notifications/ProgramNotifications.h" #include "CommonFramework/ProgramStats/StatsTracking.h" #include "CommonFramework/VideoPipeline/VideoFeed.h" @@ -109,7 +109,7 @@ void GiftReset::program(SingleSwitchProgramEnvironment& env, CancellableScope& s stats.errors++; env.update_stats(); env.log("Failed to receive gift Pokemon.", COLOR_RED); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Failed to receive gift Pokemon.", env.console diff --git a/SerialPrograms/Source/PokemonLGPE/Programs/ShinyHunting/PokemonLGPE_LegendaryReset.cpp b/SerialPrograms/Source/PokemonLGPE/Programs/ShinyHunting/PokemonLGPE_LegendaryReset.cpp index 8c5d8c67d2..2cac71fa99 100644 --- a/SerialPrograms/Source/PokemonLGPE/Programs/ShinyHunting/PokemonLGPE_LegendaryReset.cpp +++ b/SerialPrograms/Source/PokemonLGPE/Programs/ShinyHunting/PokemonLGPE_LegendaryReset.cpp @@ -4,7 +4,8 @@ * */ -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/ErrorReports/ErrorReports.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/Notifications/ProgramNotifications.h" #include "CommonFramework/ProgramStats/StatsTracking.h" #include "CommonFramework/VideoPipeline/VideoFeed.h" @@ -127,7 +128,7 @@ bool LegendaryReset::run_encounter(SingleSwitchProgramEnvironment& env, JoyconCo }else{ stats.errors++; env.update_stats(); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "run_battle(): Did not detect battle start.", env.console @@ -173,7 +174,7 @@ void LegendaryReset::program(SingleSwitchProgramEnvironment& env, CancellableSco env.update_stats(); if (consecutive_failures >= 3){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Failed 3 times in the row.", env.console @@ -196,8 +197,18 @@ void LegendaryReset::program(SingleSwitchProgramEnvironment& env, CancellableSco ); context.wait_for_all_requests(); consecutive_failures = 0; - }catch (OperationFailedException& e){ - e.send_notification(env, NOTIFICATION_ERROR_RECOVERABLE); + }catch (OperationFailedExceptionWithScreenshot& e){ + send_program_recoverable_error_notification(env, NOTIFICATION_ERROR_RECOVERABLE, e.message(), *e.screenshot()); + if (e.error_report_mode() == ErrorReport::SEND_ERROR_REPORT){ + PokemonAutomation::report_error( + &env.logger(), + env.program_info(), + "Recoverable: OperationFailedExceptionWithScreenshot", + {{"Message:", e.message()}}, + *e.screenshot(), + &e.video_stream()->history() + ); + } consecutive_failures++; } @@ -215,7 +226,7 @@ void LegendaryReset::program(SingleSwitchProgramEnvironment& env, CancellableSco stats.errors++; env.update_stats(); env.log("Timed out during battle after 5 minutes.", COLOR_RED); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Timed out during battle after 5 minutes.", env.console @@ -239,7 +250,7 @@ void LegendaryReset::program(SingleSwitchProgramEnvironment& env, CancellableSco stats.errors++; env.update_stats(); env.log("Timed out during battle. Stuck, crashed, or took more than 30 seconds for a turn.", COLOR_RED); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Timed out during battle. Stuck, crashed, or took more than 30 seconds for a turn.", env.console @@ -260,7 +271,7 @@ void LegendaryReset::program(SingleSwitchProgramEnvironment& env, CancellableSco default: stats.errors++; env.update_stats(); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Failed to detect catching menu.", env.console diff --git a/SerialPrograms/Source/PokemonLZA/Programs/Farming/PokemonLZA_DonutMaker.cpp b/SerialPrograms/Source/PokemonLZA/Programs/Farming/PokemonLZA_DonutMaker.cpp index 2d2b2e18d3..036496eb4c 100644 --- a/SerialPrograms/Source/PokemonLZA/Programs/Farming/PokemonLZA_DonutMaker.cpp +++ b/SerialPrograms/Source/PokemonLZA/Programs/Farming/PokemonLZA_DonutMaker.cpp @@ -4,7 +4,7 @@ * */ -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/ProgramStats/StatsTracking.h" #include "CommonFramework/Notifications/ProgramNotifications.h" #include "CommonFramework/VideoPipeline/VideoOverlay.h" @@ -273,7 +273,7 @@ void DonutMaker::animation_to_donut(SingleSwitchProgramEnvironment& env, ProCont if (ret != 0){ stats.errors++; env.update_stats(); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "donut_maker(): Unable to skip donut making animation.", env.console @@ -305,7 +305,7 @@ void DonutMaker::animation_to_donut(SingleSwitchProgramEnvironment& env, ProCont if (ret != 0){ stats.errors++; env.update_stats(); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "donut_maker(): Unable to find the donut flavor power screen.", env.console @@ -398,7 +398,7 @@ void DonutMaker::open_berry_menu_from_ansha(SingleSwitchProgramEnvironment& env, default: stats.errors++; env.update_stats(); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "donut_maker(): Unable to detect white dialog, selection arrow or berry menu after talking to Ansha.", env.console @@ -409,7 +409,7 @@ void DonutMaker::open_berry_menu_from_ansha(SingleSwitchProgramEnvironment& env, stats.errors++; env.update_stats(); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "donut_maker(): 2 minutes passed yet unable to reach berry menu after taking to Ansha.", env.console @@ -459,7 +459,7 @@ void exit_menu_to_overworld(SingleSwitchProgramEnvironment& env, ProControllerCo if (ret != 0){ stats.errors++; env.update_stats(); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "donut_maker(): Unable to find overworld after exiting menu.", env.console @@ -490,7 +490,7 @@ void DonutMaker::move_to_ansha(SingleSwitchProgramEnvironment& env, ProControlle if (travel_status != FastTravelState::SUCCESS){ stats.errors++; env.update_stats(); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "donut_maker(): Cannot fast travel to Hotel Z.", env.console @@ -505,7 +505,7 @@ void DonutMaker::move_to_ansha(SingleSwitchProgramEnvironment& env, ProControlle if (run_towards_gate_with_A_button(env.console, context, 0, +1, Seconds(5)) != 0){ stats.errors++; env.update_stats(); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "donut_maker(): Cannot reach Hotel Z gate after day/night change.", env.console @@ -515,7 +515,7 @@ void DonutMaker::move_to_ansha(SingleSwitchProgramEnvironment& env, ProControlle }else if (ret != 0){ stats.errors++; env.update_stats(); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "donut_maker(): Cannot reach Hotel Z gate after fast travel.", env.console diff --git a/SerialPrograms/Source/PokemonLZA/Programs/Farming/PokemonLZA_FriendshipFarmer.cpp b/SerialPrograms/Source/PokemonLZA/Programs/Farming/PokemonLZA_FriendshipFarmer.cpp index 7003ce7f9d..87272bb847 100644 --- a/SerialPrograms/Source/PokemonLZA/Programs/Farming/PokemonLZA_FriendshipFarmer.cpp +++ b/SerialPrograms/Source/PokemonLZA/Programs/Farming/PokemonLZA_FriendshipFarmer.cpp @@ -6,7 +6,7 @@ #include "PokemonLZA_FriendshipFarmer.h" -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/Exceptions/ScreenshotException.h" #include "CommonFramework/Notifications/ProgramNotifications.h" #include "CommonFramework/ProgramStats/StatsTracking.h" @@ -202,7 +202,7 @@ void FriendshipFarmer::enter_cafe(SingleSwitchProgramEnvironment& env, ProContro ++stats.errors; env.update_stats(); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "enter_cafe(): Unable to detect overworld after day/night change.", env.console @@ -210,7 +210,7 @@ void FriendshipFarmer::enter_cafe(SingleSwitchProgramEnvironment& env, ProContro default: ++stats.errors; env.update_stats(); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "enter_cafe(): No recognized state after 10 seconds.", env.console @@ -290,7 +290,7 @@ void FriendshipFarmer::exit_bench(SingleSwitchProgramEnvironment& env, ProContro ++stats.errors; env.update_stats(); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "exit_bench(): Unable to detect overworld after day/night change.", env.console @@ -304,7 +304,7 @@ void FriendshipFarmer::exit_bench(SingleSwitchProgramEnvironment& env, ProContro ++stats.errors; env.update_stats(); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "exit_bench(): No recognized state after 10 seconds.", env.console @@ -379,7 +379,7 @@ void FriendshipFarmer::exit_cafe(SingleSwitchProgramEnvironment& env, ProControl ++stats.errors; env.update_stats(); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "exit_cafe(): Unable to detect overworld after day/night change.", env.console @@ -387,7 +387,7 @@ void FriendshipFarmer::exit_cafe(SingleSwitchProgramEnvironment& env, ProControl default: ++stats.errors; env.update_stats(); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "exit_cafe(): No recognized state after 10 seconds.", env.console @@ -484,7 +484,7 @@ void FriendshipFarmer::hang_out_bench(SingleSwitchProgramEnvironment& env, ProCo ++stats.errors; env.update_stats(); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "hang_out_bench(): Unable to detect overworld after day/night change.", env.console @@ -492,7 +492,7 @@ void FriendshipFarmer::hang_out_bench(SingleSwitchProgramEnvironment& env, ProCo default: ++stats.errors; env.update_stats(); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "hang_out_bench(): No recognized state after 10 seconds.", env.console diff --git a/SerialPrograms/Source/PokemonLZA/Programs/Farming/PokemonLZA_HyperspaceRewardReset.cpp b/SerialPrograms/Source/PokemonLZA/Programs/Farming/PokemonLZA_HyperspaceRewardReset.cpp index 292e07a13c..50255f7bec 100644 --- a/SerialPrograms/Source/PokemonLZA/Programs/Farming/PokemonLZA_HyperspaceRewardReset.cpp +++ b/SerialPrograms/Source/PokemonLZA/Programs/Farming/PokemonLZA_HyperspaceRewardReset.cpp @@ -5,7 +5,7 @@ */ #include "CommonFramework/Logging/Logger.h" -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/Notifications/ProgramNotifications.h" #include "CommonFramework/ProgramStats/StatsTracking.h" #include "CommonFramework/VideoPipeline/VideoFeed.h" @@ -131,7 +131,7 @@ void HyperspaceRewardReset::talk_to_trainer(SingleSwitchProgramEnvironment& env, default: stats.errors++; env.update_stats(); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "talk_to_trainer(): Failed to detect blue item received dialog.", env.console diff --git a/SerialPrograms/Source/PokemonLZA/Programs/Farming/PokemonLZA_InPlaceCatcher.cpp b/SerialPrograms/Source/PokemonLZA/Programs/Farming/PokemonLZA_InPlaceCatcher.cpp index a6088ca6d0..735a662447 100644 --- a/SerialPrograms/Source/PokemonLZA/Programs/Farming/PokemonLZA_InPlaceCatcher.cpp +++ b/SerialPrograms/Source/PokemonLZA/Programs/Farming/PokemonLZA_InPlaceCatcher.cpp @@ -4,7 +4,7 @@ * */ -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/ProgramStats/StatsTracking.h" #include "CommonFramework/Notifications/ProgramNotifications.h" //#include "CommonTools/Async/InferenceSession.h" @@ -135,7 +135,7 @@ void InPlaceCatcher::day_night_handler(SingleSwitchProgramEnvironment& env, ProC default: stats.errors++; env.update_stats(); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Unable to detect end of day/night change after 2 minutes.", env.console diff --git a/SerialPrograms/Source/PokemonLZA/Programs/Farming/PokemonLZA_JacintheInfiniteFarmer.cpp b/SerialPrograms/Source/PokemonLZA/Programs/Farming/PokemonLZA_JacintheInfiniteFarmer.cpp index c7b3826731..b5f50bbcbd 100644 --- a/SerialPrograms/Source/PokemonLZA/Programs/Farming/PokemonLZA_JacintheInfiniteFarmer.cpp +++ b/SerialPrograms/Source/PokemonLZA/Programs/Farming/PokemonLZA_JacintheInfiniteFarmer.cpp @@ -5,7 +5,7 @@ */ #include "CommonFramework/Logging/Logger.h" -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/ProgramStats/StatsTracking.h" #include "CommonFramework/Tools/ErrorDumper.h" #include "CommonTools/Async/InterruptableCommands.h" @@ -215,7 +215,7 @@ bool JacintheInfiniteFarmer::talk_to_jacinthe(SingleSwitchProgramEnvironment& en if (ret != 0){ stats.errors++; env.update_stats(); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "talk_to_jacinthe(): Does not detect transparent battle dialog 20 sec after black screen.", env.console @@ -232,7 +232,7 @@ bool JacintheInfiniteFarmer::talk_to_jacinthe(SingleSwitchProgramEnvironment& en default: stats.errors++; env.update_stats(); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "talk_to_jacinthe(): No recognized state after 60 seconds.", env.console @@ -275,7 +275,7 @@ void JacintheInfiniteFarmer::run_round(SingleSwitchProgramEnvironment& env, ProC default: stats.errors++; env.update_stats(); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "run_round(): no battle state or dialog window detected after 50 sec.", env.console diff --git a/SerialPrograms/Source/PokemonLZA/Programs/Farming/PokemonLZA_MegaShardFarmer.cpp b/SerialPrograms/Source/PokemonLZA/Programs/Farming/PokemonLZA_MegaShardFarmer.cpp index 3e4bb61d55..62fe472b29 100644 --- a/SerialPrograms/Source/PokemonLZA/Programs/Farming/PokemonLZA_MegaShardFarmer.cpp +++ b/SerialPrograms/Source/PokemonLZA/Programs/Farming/PokemonLZA_MegaShardFarmer.cpp @@ -5,7 +5,7 @@ */ #include "CommonFramework/StaticGlobals.h" -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/ProgramStats/StatsTracking.h" #include "CommonTools/Async/InferenceRoutines.h" #include "CommonTools/VisualDetectors/BlackScreenDetector.h" @@ -165,7 +165,7 @@ void MegaShardFarmer::fly_back(SingleSwitchProgramEnvironment& env, ProControlle MegaShardFarmer_Descriptor::Stats& stats = env.current_stats(); stats.errors++; env.update_stats(); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Failed to fly 3 times in the row.", env.console diff --git a/SerialPrograms/Source/PokemonLZA/Programs/Farming/PokemonLZA_RestaurantFarmer.cpp b/SerialPrograms/Source/PokemonLZA/Programs/Farming/PokemonLZA_RestaurantFarmer.cpp index 83cc1d8b70..8b2f0a64d6 100644 --- a/SerialPrograms/Source/PokemonLZA/Programs/Farming/PokemonLZA_RestaurantFarmer.cpp +++ b/SerialPrograms/Source/PokemonLZA/Programs/Farming/PokemonLZA_RestaurantFarmer.cpp @@ -5,7 +5,7 @@ */ //#include "CommonFramework/Logging/Logger.h" -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/ProgramStats/StatsTracking.h" #include "CommonFramework/Tools/ErrorDumper.h" //#include "CommonFramework/VideoPipeline/VideoFeed.h" @@ -181,7 +181,7 @@ bool RestaurantFarmer::run_lobby(SingleSwitchProgramEnvironment& env, ProControl default: stats.errors++; env.update_stats(); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "run_lobby(): No recognized state after 10 seconds.", env.console @@ -276,7 +276,7 @@ void RestaurantFarmer::run_round(SingleSwitchProgramEnvironment& env, ProControl default: stats.errors++; env.update_stats(); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "run_round(): No state detected for 2 minutes.", env.console diff --git a/SerialPrograms/Source/PokemonLZA/Programs/Farming/PokemonLZA_WigglytuffFarmer.cpp b/SerialPrograms/Source/PokemonLZA/Programs/Farming/PokemonLZA_WigglytuffFarmer.cpp index 51cac3bdc0..aef3928d61 100644 --- a/SerialPrograms/Source/PokemonLZA/Programs/Farming/PokemonLZA_WigglytuffFarmer.cpp +++ b/SerialPrograms/Source/PokemonLZA/Programs/Farming/PokemonLZA_WigglytuffFarmer.cpp @@ -4,7 +4,7 @@ * */ -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/ProgramStats/StatsTracking.h" #include "CommonFramework/Notifications/ProgramNotifications.h" #include "CommonTools/Async/InferenceRoutines.h" @@ -154,7 +154,7 @@ bool WigglytuffFarmer::run_lobby(SingleSwitchProgramEnvironment& env, ProControl default: stats.errors++; env.update_stats(); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "run_lobby(): No recognized state after 30 seconds.", env.console @@ -205,7 +205,7 @@ void WigglytuffFarmer::run_round(SingleSwitchProgramEnvironment& env, ProControl default: stats.errors++; env.update_stats(); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "run_round(): No state detected for 2 minutes.", env.console diff --git a/SerialPrograms/Source/PokemonLZA/Programs/NonShinyHunting/PokemonLZA_StatsReset.cpp b/SerialPrograms/Source/PokemonLZA/Programs/NonShinyHunting/PokemonLZA_StatsReset.cpp index a7cce58244..a6cca58755 100644 --- a/SerialPrograms/Source/PokemonLZA/Programs/NonShinyHunting/PokemonLZA_StatsReset.cpp +++ b/SerialPrograms/Source/PokemonLZA/Programs/NonShinyHunting/PokemonLZA_StatsReset.cpp @@ -4,7 +4,7 @@ * */ -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/Notifications/ProgramNotifications.h" #include "CommonFramework/ProgramStats/StatsTracking.h" #include "CommonFramework/VideoPipeline/VideoFeed.h" @@ -305,7 +305,7 @@ void StatsReset::program(SingleSwitchProgramEnvironment& env, ProControllerConte if (travel_status != FastTravelState::SUCCESS){ stats.errors++; env.update_stats(); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Failed to travel to Quasartico Inc.", env.console @@ -343,7 +343,7 @@ void StatsReset::program(SingleSwitchProgramEnvironment& env, ProControllerConte if (travel_status != FastTravelState::SUCCESS){ stats.errors++; env.update_stats(); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Failed to travel to Lysandre Café", env.console @@ -400,7 +400,7 @@ void StatsReset::program(SingleSwitchProgramEnvironment& env, ProControllerConte if (travel_status != FastTravelState::SUCCESS){ stats.errors++; env.update_stats(); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Failed to travel to Wild Zone 13", env.console @@ -440,7 +440,7 @@ void StatsReset::program(SingleSwitchProgramEnvironment& env, ProControllerConte if (travel_status != FastTravelState::SUCCESS){ stats.errors++; env.update_stats(); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Failed to travel to Research Lab", env.console diff --git a/SerialPrograms/Source/PokemonLZA/Programs/PokemonLZA_BasicNavigation.cpp b/SerialPrograms/Source/PokemonLZA/Programs/PokemonLZA_BasicNavigation.cpp index 124e31bdee..0848663e53 100644 --- a/SerialPrograms/Source/PokemonLZA/Programs/PokemonLZA_BasicNavigation.cpp +++ b/SerialPrograms/Source/PokemonLZA/Programs/PokemonLZA_BasicNavigation.cpp @@ -5,7 +5,7 @@ */ #include "Common/Cpp/PrettyPrint.h" -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonTools/Async/InferenceRoutines.h" #include "CommonTools/VisualDetectors/BlackScreenDetector.h" #include "NintendoSwitch/Commands/NintendoSwitch_Commands_PushButtons.h" @@ -35,7 +35,7 @@ bool save_game_to_menu(ConsoleHandle& console, ProControllerContext& context){ context.wait_for_all_requests(); if (current_time() - start > std::chrono::seconds(120)){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "save_game_to_menu(): Unable to save game after 2 minutes.", console @@ -164,7 +164,7 @@ bool open_map( }while (current_time() < deadline); console.overlay().add_log("Failed to Open Map After 30 sec", COLOR_RED); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "open_map(): Unable to find map after 30 seconds.", console @@ -205,7 +205,7 @@ FastTravelState fly_from_map( console.overlay().add_log("Not On Fast Travel Location"); return FastTravelState::NOT_AT_FLY_SPOT; #if 0 - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "fly_from_map(): Unable to fly.", console @@ -235,7 +235,7 @@ FastTravelState fly_from_map( {{overworld}} ); if (ret != 0){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "fly_from_map(): Does not detect overworld after encountering blue dialog.", console @@ -245,7 +245,7 @@ FastTravelState fly_from_map( console.overlay().add_log("Fast Travel Done"); break; default: - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "fly_from_map(): Does not detect overworld after fast travel.", console @@ -383,7 +383,7 @@ void sit_on_bench(ConsoleHandle& console, ProControllerContext& context){ console.log("Detected day change."); break; default: - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "sit_on_bench(): No day/night transition detected after mashing A.", console @@ -399,7 +399,7 @@ void sit_on_bench(ConsoleHandle& console, ProControllerContext& context){ {overworld} ); if (ret < 0){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "sit_on_bench(): Unable to go back to overworld after day/night change on bench after 30 seconds.", console @@ -420,7 +420,7 @@ void wait_until_overworld( {overworld, map_arrow} ); if (ret < 0){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "wait_until_overworld(): Unable to detect overworld after " + std::to_string(max_wait_time.count()) + " milliseconds.", @@ -445,7 +445,7 @@ double get_facing_direction( if (ret != 0){ console.log("Direction arrow not detected within 1 second"); console.overlay().add_log("No Minimap Arrow Found", COLOR_RED); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "get_facing_direction(): Direction arrow on minimap not detected within 40 second", console diff --git a/SerialPrograms/Source/PokemonLZA/Programs/PokemonLZA_BoxSorter.cpp b/SerialPrograms/Source/PokemonLZA/Programs/PokemonLZA_BoxSorter.cpp index a1c608e869..254674e6e2 100644 --- a/SerialPrograms/Source/PokemonLZA/Programs/PokemonLZA_BoxSorter.cpp +++ b/SerialPrograms/Source/PokemonLZA/Programs/PokemonLZA_BoxSorter.cpp @@ -11,7 +11,7 @@ #include #include #include "Common/Cpp/Exceptions.h" -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/ImageTools/ImageBoxes.h" #include "CommonFramework/ImageTools/ImageStats.h" #include "CommonFramework/Notifications/ProgramNotifications.h" @@ -302,7 +302,7 @@ void BoxSorter::program(SingleSwitchProgramEnvironment& env, ProControllerContex bool dex_number_detected = dex_number_detector.detect(screen); if (!dex_number_detected){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "BoxSorting Check Summary: Unable to read a correct dex number, found: " + std::to_string(dex_number_detector.dex_number_when_error()), env.console diff --git a/SerialPrograms/Source/PokemonLZA/Programs/PokemonLZA_ClothingBuyer.cpp b/SerialPrograms/Source/PokemonLZA/Programs/PokemonLZA_ClothingBuyer.cpp index 9b6a447146..52f37898ed 100644 --- a/SerialPrograms/Source/PokemonLZA/Programs/PokemonLZA_ClothingBuyer.cpp +++ b/SerialPrograms/Source/PokemonLZA/Programs/PokemonLZA_ClothingBuyer.cpp @@ -5,7 +5,7 @@ */ #include "CommonFramework/Notifications/ProgramNotifications.h" -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonTools/Async/InferenceRoutines.h" #include "CommonTools/StartupChecks/VideoResolutionCheck.h" #include "NintendoSwitch/Commands/NintendoSwitch_Commands_PushButtons.h" @@ -116,7 +116,7 @@ void ClothingBuyer::program(SingleSwitchProgramEnvironment& env, ProControllerCo break; default: env.log("Error looking for purchase prompt."); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Error looking for purchase prompt.", env.console diff --git a/SerialPrograms/Source/PokemonLZA/Programs/PokemonLZA_DonutBerrySession.cpp b/SerialPrograms/Source/PokemonLZA/Programs/PokemonLZA_DonutBerrySession.cpp index fe7b4a338f..37bc5f0075 100644 --- a/SerialPrograms/Source/PokemonLZA/Programs/PokemonLZA_DonutBerrySession.cpp +++ b/SerialPrograms/Source/PokemonLZA/Programs/PokemonLZA_DonutBerrySession.cpp @@ -55,7 +55,7 @@ PageIngredients BerrySession::read_screen(std::shared_ptr scre ret.selected = (int8_t)slot; //cout << "selected slot = " << (int)ret.selected << endl; if (ret.selected < 0 || ret.selected >= 8){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "BerrySession::read_current_page(): Invalid cursor slot.", m_stream, @@ -112,7 +112,7 @@ PageIngredients BerrySession::read_screen(std::shared_ptr scre for (const auto& p : image_result.results){ sprite_result.insert(p.second); } - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "BerrySession::read_current_page(): Unable to read selected item. OCR and sprite do not agree on any match: ocr " + set_to_str(ocr_result) + ", sprite " + set_to_str(sprite_result), @@ -125,7 +125,7 @@ PageIngredients BerrySession::read_screen(std::shared_ptr scre for (const auto& p : image_result.results){ sprite_result.insert(p.second); } - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "BerrySession::read_current_page(): Unable to read selected item. Ambiguous result: " + set_to_str(ocr_result) + ", " + set_to_str(sprite_result) + "\n" + language_warning(m_language), @@ -345,7 +345,7 @@ void BerrySession::add_berries( } if (!ingredient_added){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::NO_ERROR_REPORT, "Unable to add ingredient: \"" + name.display_name() + "\" - Did you run out?", stream diff --git a/SerialPrograms/Source/PokemonLZA/Programs/PokemonLZA_DonutBerrySession.h b/SerialPrograms/Source/PokemonLZA/Programs/PokemonLZA_DonutBerrySession.h index 75143ede3b..28c8f35c19 100644 --- a/SerialPrograms/Source/PokemonLZA/Programs/PokemonLZA_DonutBerrySession.h +++ b/SerialPrograms/Source/PokemonLZA/Programs/PokemonLZA_DonutBerrySession.h @@ -9,7 +9,7 @@ #include #include -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/Language.h" #include "CommonFramework/VideoPipeline/VideoOverlayScopes.h" #include "CommonFramework/Tools/VideoStream.h" @@ -29,9 +29,9 @@ struct PageIngredients{ }; -class BerryNotFoundException : public OperationFailedException{ +class BerryNotFoundException : public OperationFailedExceptionWithScreenshot{ public: - using OperationFailedException::OperationFailedException; + using OperationFailedExceptionWithScreenshot::OperationFailedExceptionWithScreenshot; }; diff --git a/SerialPrograms/Source/PokemonLZA/Programs/PokemonLZA_FastTravelNavigation.cpp b/SerialPrograms/Source/PokemonLZA/Programs/PokemonLZA_FastTravelNavigation.cpp index 3c31ddd233..8846854b83 100644 --- a/SerialPrograms/Source/PokemonLZA/Programs/PokemonLZA_FastTravelNavigation.cpp +++ b/SerialPrograms/Source/PokemonLZA/Programs/PokemonLZA_FastTravelNavigation.cpp @@ -5,7 +5,7 @@ */ #include -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/Tools/GlobalThreadPools.h" #include "CommonFramework/VideoPipeline/VideoFeed.h" #include "NintendoSwitch/Commands/NintendoSwitch_Commands_PushButtons.h" @@ -408,7 +408,7 @@ void set_fast_travel_menu_filter( bool filters_menu_opened = open_fast_travel_filters_menu(console, context); if (!filters_menu_opened){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "set_fast_travel_menu_filter(): Unable to open fast travel filter menu.", console @@ -447,7 +447,7 @@ void set_fast_travel_menu_filter( } } } while (current_time() < deadline); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "set_fast_travel_menu_filter(): Unable to set fast travel filter.", console @@ -473,7 +473,7 @@ void open_fast_travel_menu( console.log("Fast travel menu opened."); return; default: - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "open_fast_travel_menu(): Unable to open fast travel menu.", console @@ -541,7 +541,7 @@ FastTravelState open_map_and_fly_to(ConsoleHandle& console, ProControllerContext console.log("Pursued by wild pokemon while flying to " + target_slug); return FastTravelState::PURSUED; default: - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "open_map_and_fly_to(): Unable to fast travel to " + target_slug, console @@ -556,7 +556,7 @@ FastTravelState open_map_and_fly_to(ConsoleHandle& console, ProControllerContext console.log("Arrived at " + target_slug); return FastTravelState::SUCCESS; default: - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "open_map_and_fly_to(): Overworld not detected", console diff --git a/SerialPrograms/Source/PokemonLZA/Programs/PokemonLZA_HyperspaceNavigation.cpp b/SerialPrograms/Source/PokemonLZA/Programs/PokemonLZA_HyperspaceNavigation.cpp index 70dc174502..d078b7f754 100644 --- a/SerialPrograms/Source/PokemonLZA/Programs/PokemonLZA_HyperspaceNavigation.cpp +++ b/SerialPrograms/Source/PokemonLZA/Programs/PokemonLZA_HyperspaceNavigation.cpp @@ -4,7 +4,7 @@ * */ -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/Notifications/ProgramNotifications.h" #include "CommonFramework/VideoPipeline/VideoOverlay.h" #include "CommonTools/Async/InferenceRoutines.h" @@ -33,7 +33,7 @@ bool check_calorie( console, context, std::chrono::seconds(5), {calorie_watcher} ); if (ret < 0){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "check_calorie(): does not detect Calorie number after waiting for five seconds", console @@ -75,7 +75,7 @@ void detect_interactable( {ButtonA} ); if (ret < 0){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "detect_interactable_pad(): Cannot detect interactable after 5 seconds", console diff --git a/SerialPrograms/Source/PokemonLZA/Programs/PokemonLZA_MenuNavigation.cpp b/SerialPrograms/Source/PokemonLZA/Programs/PokemonLZA_MenuNavigation.cpp index a057e6e545..867ea4ecd4 100644 --- a/SerialPrograms/Source/PokemonLZA/Programs/PokemonLZA_MenuNavigation.cpp +++ b/SerialPrograms/Source/PokemonLZA/Programs/PokemonLZA_MenuNavigation.cpp @@ -5,7 +5,7 @@ * Functions to navigate main menu */ -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonTools/Async/InferenceRoutines.h" // #include "CommonTools/VisualDetectors/BlackScreenDetector.h" // #include "NintendoSwitch/Commands/NintendoSwitch_Commands_PushButtons.h" @@ -55,7 +55,7 @@ void overworld_to_main_menu(ConsoleHandle& console, ProControllerContext& contex pbf_press_button(context, BUTTON_B, 160ms, 240ms); continue; default: - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "overworld_to_main_menu(): No state detected after 30 seconds.", console @@ -63,7 +63,7 @@ void overworld_to_main_menu(ConsoleHandle& console, ProControllerContext& contex } } - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "overworld_to_main_menu(): Failed to enter box system after 2 minutes.", console @@ -100,7 +100,7 @@ void overworld_to_box_system(ConsoleHandle& console, ProControllerContext& conte console.log("Detected Box System..."); return; default: - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "overworld_to_box_system(): No state detected after 30 seconds.", console @@ -108,7 +108,7 @@ void overworld_to_box_system(ConsoleHandle& console, ProControllerContext& conte } } - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "overworld_to_box_system(): Failed to enter box system after 2 minutes.", console @@ -145,7 +145,7 @@ void box_system_to_overworld(ConsoleHandle& console, ProControllerContext& conte pbf_press_button(context, BUTTON_B, 160ms, 240ms); continue; default: - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "overworld_to_box_system(): No state detected after 30 seconds.", console @@ -153,7 +153,7 @@ void box_system_to_overworld(ConsoleHandle& console, ProControllerContext& conte } } - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "overworld_to_box_system(): Failed to exit box system after 2 minutes.", console diff --git a/SerialPrograms/Source/PokemonLZA/Programs/PokemonLZA_StallBuyer.cpp b/SerialPrograms/Source/PokemonLZA/Programs/PokemonLZA_StallBuyer.cpp index a57dfb08e9..7e296189ac 100644 --- a/SerialPrograms/Source/PokemonLZA/Programs/PokemonLZA_StallBuyer.cpp +++ b/SerialPrograms/Source/PokemonLZA/Programs/PokemonLZA_StallBuyer.cpp @@ -4,7 +4,7 @@ * */ -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/Notifications/ProgramNotifications.h" #include "CommonFramework/ProgramStats/StatsTracking.h" #include "CommonFramework/VideoPipeline/VideoFeed.h" @@ -139,7 +139,7 @@ int detect_stall_amount_item(SingleSwitchProgramEnvironment& env, StallBuyer_Des }else{ stats.errors++; env.update_stats(); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "No recognized stall size.", env.console @@ -251,7 +251,7 @@ void StallBuyer::make_purchase( default: stats.errors++; env.update_stats(); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "No recognized state after 30 seconds.", env.console diff --git a/SerialPrograms/Source/PokemonLZA/Programs/ShinyHunting/PokemonLZA_AutoFossil.cpp b/SerialPrograms/Source/PokemonLZA/Programs/ShinyHunting/PokemonLZA_AutoFossil.cpp index 6de1814db0..a05c3aee4d 100644 --- a/SerialPrograms/Source/PokemonLZA/Programs/ShinyHunting/PokemonLZA_AutoFossil.cpp +++ b/SerialPrograms/Source/PokemonLZA/Programs/ShinyHunting/PokemonLZA_AutoFossil.cpp @@ -5,7 +5,7 @@ */ #include "CommonFramework/ProgramStats/StatsTracking.h" -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/Notifications/ProgramNotifications.h" #include "CommonFramework/VideoPipeline/VideoFeed.h" #include "CommonTools/Async/InferenceRoutines.h" @@ -257,7 +257,7 @@ void AutoFossil::revive_one_fossil(SingleSwitchProgramEnvironment& env, ProContr default: stats.errors++; env.update_stats(); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "revive_one_fossil(): No recognized state after 10 seconds.", env.console @@ -285,7 +285,7 @@ bool AutoFossil::check_fossils_in_one_box( info_watcher.reset_state(); const int ret = wait_until(env.console, context, Seconds(5), {info_watcher}); if (ret < 0){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Failed to detect box info at cell idx " + std::to_string(i) + " after 5 seconds", env.console diff --git a/SerialPrograms/Source/PokemonLZA/Programs/ShinyHunting/PokemonLZA_BeldumHunter.cpp b/SerialPrograms/Source/PokemonLZA/Programs/ShinyHunting/PokemonLZA_BeldumHunter.cpp index 75588dac8d..cdc304a73f 100644 --- a/SerialPrograms/Source/PokemonLZA/Programs/ShinyHunting/PokemonLZA_BeldumHunter.cpp +++ b/SerialPrograms/Source/PokemonLZA/Programs/ShinyHunting/PokemonLZA_BeldumHunter.cpp @@ -4,7 +4,8 @@ * */ -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/ErrorReports/ErrorReports.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/ProgramStats/StatsTracking.h" #include "CommonFramework/Notifications/ProgramNotifications.h" #include "CommonFramework/VideoPipeline/VideoFeed.h" @@ -110,7 +111,7 @@ bool BeldumHunter::run_iteration(SingleSwitchProgramEnvironment& env, ProControl env.log("Entered the lab."); }else{ env.log("Failed to enter the lab."); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Failed to warp.", env.console @@ -197,9 +198,19 @@ void BeldumHunter::program(SingleSwitchProgramEnvironment& env, ProControllerCon "", env.console.video().snapshot(), true); break; } - }catch (OperationFailedException& e){ + }catch (OperationFailedExceptionWithScreenshot& e){ stats.errors++; - e.send_notification(env, NOTIFICATION_ERROR_RECOVERABLE); + send_program_recoverable_error_notification(env, NOTIFICATION_ERROR_RECOVERABLE, e.message(), *e.screenshot()); + if (e.error_report_mode() == ErrorReport::SEND_ERROR_REPORT){ + PokemonAutomation::report_error( + &env.logger(), + env.program_info(), + "Recoverable: OperationFailedExceptionWithScreenshot", + {{"Message:", e.message()}}, + *e.screenshot(), + &e.video_stream()->history() + ); + } pbf_press_button(context, BUTTON_HOME, 160ms, 3000ms); reset_game_from_home(env, env.console, context, false); diff --git a/SerialPrograms/Source/PokemonLZA/Programs/ShinyHunting/PokemonLZA_SewerHunter.cpp b/SerialPrograms/Source/PokemonLZA/Programs/ShinyHunting/PokemonLZA_SewerHunter.cpp index b4142560be..f375a804e5 100644 --- a/SerialPrograms/Source/PokemonLZA/Programs/ShinyHunting/PokemonLZA_SewerHunter.cpp +++ b/SerialPrograms/Source/PokemonLZA/Programs/ShinyHunting/PokemonLZA_SewerHunter.cpp @@ -4,7 +4,7 @@ * */ -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/ProgramStats/StatsTracking.h" #include "CommonFramework/Notifications/ProgramNotifications.h" #include "CommonFramework/VideoPipeline/VideoOverlay.h" @@ -102,7 +102,7 @@ void fly_back_to_sewers_entrance(ConsoleHandle& console, ProControllerContext& c {black_screen} ); if (ret != 0){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "fly_back_to_sewers_entrance(): cannot detect black screen after mashing A.", console @@ -203,7 +203,7 @@ void ShinyHunt_SewerHunter::program(SingleSwitchProgramEnvironment& env, ProCont route = route_ariados; break; default: - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "route not implemented", env.console diff --git a/SerialPrograms/Source/PokemonLZA/Programs/ShinyHunting/PokemonLZA_ShinyHunt_BenchSit.cpp b/SerialPrograms/Source/PokemonLZA/Programs/ShinyHunting/PokemonLZA_ShinyHunt_BenchSit.cpp index 55aae2ed0b..da46494f78 100644 --- a/SerialPrograms/Source/PokemonLZA/Programs/ShinyHunting/PokemonLZA_ShinyHunt_BenchSit.cpp +++ b/SerialPrograms/Source/PokemonLZA/Programs/ShinyHunting/PokemonLZA_ShinyHunt_BenchSit.cpp @@ -5,7 +5,7 @@ */ #include "CommonFramework/StaticGlobals.h" -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/ProgramStats/StatsTracking.h" #include "CommonFramework/Notifications/ProgramNotifications.h" #include "CommonFramework/VideoPipeline/VideoFeed.h" @@ -177,7 +177,7 @@ void run_back_until_found_bench( env.console.log("Detected floating A button..."); break; default: - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "run_back_until_found_bench(): Unable to detect bench after multiple attempts.", env.console diff --git a/SerialPrograms/Source/PokemonLZA/Programs/ShinyHunting/PokemonLZA_ShinyHunt_FlySpotReset.cpp b/SerialPrograms/Source/PokemonLZA/Programs/ShinyHunting/PokemonLZA_ShinyHunt_FlySpotReset.cpp index b3bdc2ed8e..cdb07decb3 100644 --- a/SerialPrograms/Source/PokemonLZA/Programs/ShinyHunting/PokemonLZA_ShinyHunt_FlySpotReset.cpp +++ b/SerialPrograms/Source/PokemonLZA/Programs/ShinyHunting/PokemonLZA_ShinyHunt_FlySpotReset.cpp @@ -4,7 +4,7 @@ * */ -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/ProgramStats/StatsTracking.h" #include "CommonFramework/Notifications/ProgramNotifications.h" #include "CommonFramework/VideoPipeline/VideoOverlay.h" @@ -150,7 +150,7 @@ void route_default( if (!can_fast_travel){ stats.errors++; env.update_stats(); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "route_default(): Cannot open map for fast travel.", env.console @@ -165,7 +165,7 @@ void route_default( if (travel_status != FastTravelState::SUCCESS){ stats.errors++; env.update_stats(); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "route_default(): Cannot fast travel after moving map cursor.", env.console @@ -260,7 +260,7 @@ bool route_hyperspace_wild_zone( if (!hyperspace_calorie_detector.detect(*overworld_screen)){ stats.errors++; env.update_stats(); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "route_hyperspace_wild_zone(): Cannot read Calorie number on screen.", env.console @@ -331,7 +331,7 @@ void ShinyHunt_FlySpotReset::program(SingleSwitchProgramEnvironment& env, ProCon route = route_alpha_pidgey; break; default: - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "route not implemented", env.console diff --git a/SerialPrograms/Source/PokemonLZA/Programs/ShinyHunting/PokemonLZA_ShinyHunt_HyperspaceHunter.cpp b/SerialPrograms/Source/PokemonLZA/Programs/ShinyHunting/PokemonLZA_ShinyHunt_HyperspaceHunter.cpp index d78d0d9cfd..c716a5152f 100644 --- a/SerialPrograms/Source/PokemonLZA/Programs/ShinyHunting/PokemonLZA_ShinyHunt_HyperspaceHunter.cpp +++ b/SerialPrograms/Source/PokemonLZA/Programs/ShinyHunting/PokemonLZA_ShinyHunt_HyperspaceHunter.cpp @@ -4,7 +4,7 @@ * */ -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/ProgramStats/StatsTracking.h" #include "CommonFramework/Notifications/ProgramNotifications.h" #include "CommonFramework/VideoPipeline/VideoOverlay.h" @@ -185,7 +185,7 @@ void ShinyHunt_HyperspaceHunter::use_fly_spot_reset( if (!open_map(env.console, context, zoom_to_max, require_icons)){ stats.errors++; env.update_stats(); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "use_fly_spot_reset(): Cannot fast travel after being chased by wild pokemon.", env.console @@ -198,7 +198,7 @@ void ShinyHunt_HyperspaceHunter::use_fly_spot_reset( if (travel_status != FastTravelState::SUCCESS){ stats.errors++; env.update_stats(); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "use_fly_spot_reset(): Cannot fast travel after moving map cursor.", env.console @@ -212,7 +212,7 @@ void ShinyHunt_HyperspaceHunter::use_fly_spot_reset( if (!hyperspace_calorie_detector.detect(*overworld_screen)){ stats.errors++; env.update_stats(); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "use_fly_spot_reset(): Cannot read Calorie number on screen.", env.console diff --git a/SerialPrograms/Source/PokemonLZA/Programs/ShinyHunting/PokemonLZA_ShinyHunt_HyperspaceLegendary.cpp b/SerialPrograms/Source/PokemonLZA/Programs/ShinyHunting/PokemonLZA_ShinyHunt_HyperspaceLegendary.cpp index 206991c48a..9403032c7d 100644 --- a/SerialPrograms/Source/PokemonLZA/Programs/ShinyHunting/PokemonLZA_ShinyHunt_HyperspaceLegendary.cpp +++ b/SerialPrograms/Source/PokemonLZA/Programs/ShinyHunting/PokemonLZA_ShinyHunt_HyperspaceLegendary.cpp @@ -4,7 +4,7 @@ * */ -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/ImageTools/ImageBoxes.h" #include "CommonFramework/ImageTools/ImageStats.h" #include "CommonFramework/ImageTypes/ImageHSV32.h" @@ -345,7 +345,7 @@ void hunt_latias_check( {{ButtonA}} ); if (ret < 0){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "hunt_latias(): Cannot detect ladder after 5 seconds", env.console @@ -741,7 +741,7 @@ void ShinyHunt_HyperspaceLegendary::program(SingleSwitchProgramEnvironment& env, }else if (LEGENDARY == Legendary::COBALION){ hunt_cobalion(env, context, stats, MIN_CALORIE_TO_CATCH); }else{ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "legendary hunt not implemented", env.console diff --git a/SerialPrograms/Source/PokemonLZA/Programs/ShinyHunting/PokemonLZA_ShuttleRun.cpp b/SerialPrograms/Source/PokemonLZA/Programs/ShinyHunting/PokemonLZA_ShuttleRun.cpp index 75734ad0cb..8428de9f7d 100644 --- a/SerialPrograms/Source/PokemonLZA/Programs/ShinyHunting/PokemonLZA_ShuttleRun.cpp +++ b/SerialPrograms/Source/PokemonLZA/Programs/ShinyHunting/PokemonLZA_ShuttleRun.cpp @@ -4,7 +4,7 @@ * */ -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/ProgramStats/StatsTracking.h" #include "CommonFramework/Notifications/ProgramNotifications.h" #include "Common/Cpp/PrettyPrint.h" @@ -106,7 +106,7 @@ void route_alpha_pidgeot(SingleSwitchProgramEnvironment& env, ProControllerConte open_map(env.console, context, false, true); pbf_move_left_joystick(context, {+0.157, +0.156}, 100ms, 200ms); if (fly_from_map(env.console, context) == FastTravelState::NOT_AT_FLY_SPOT){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "fly_from_map(): Unable to fast travel", env.console); @@ -151,7 +151,7 @@ void route_wild_zone_3_tower(SingleSwitchProgramEnvironment& env, ProControllerC // if facing west or north, run forward pbf_move_left_joystick(context, {0, +1}, 500ms, 200ms); }else{ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "route_wild_zone_3_tower: unexpected facing direction: " + PokemonAutomation::tostr_fixed(direction, 0) + " deg", env.console @@ -193,7 +193,7 @@ void ShinyHunt_ShuttleRun::program(SingleSwitchProgramEnvironment& env, ProContr route = route_wild_zone_3_tower; break; default: - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "route not implemented", env.console diff --git a/SerialPrograms/Source/PokemonLZA/Programs/ShinyHunting/PokemonLZA_WildZoneCafe.cpp b/SerialPrograms/Source/PokemonLZA/Programs/ShinyHunting/PokemonLZA_WildZoneCafe.cpp index 7b46139d2b..d8c954dd4c 100644 --- a/SerialPrograms/Source/PokemonLZA/Programs/ShinyHunting/PokemonLZA_WildZoneCafe.cpp +++ b/SerialPrograms/Source/PokemonLZA/Programs/ShinyHunting/PokemonLZA_WildZoneCafe.cpp @@ -8,7 +8,7 @@ #include "Common/Cpp/Time.h" #include "CommonFramework/StaticGlobals.h" #include "CommonFramework/GlobalSettingsPanel.h" -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/ProgramStats/StatsTracking.h" #include "CommonFramework/Notifications/ProgramNotifications.h" #include "CommonFramework/Globals.h" @@ -147,7 +147,7 @@ void do_one_cafe_trip( } else if (travel_status == FastTravelState::NOT_AT_FLY_SPOT){ stats.errors++; env.update_stats(); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "do_one_cafe_trip: Cannot fast travel after moving map cursor.", env.console @@ -207,7 +207,7 @@ void do_one_cafe_trip( if (ret != 0){ stats.errors++; env.update_stats(); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "do_one_cafe_trip: Cannot reach wild zone gate after day/night change.", env.console @@ -218,7 +218,7 @@ void do_one_cafe_trip( default: stats.errors++; env.update_stats(); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "do_one_cafe_trip: Cannot reach wild zone gate after being chased by wild pokemon.", env.console @@ -241,7 +241,7 @@ void do_one_cafe_trip( // cannot fast travel outside zone. Chased by wild pokemon that used Dig? stats.errors++; env.update_stats(); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "do_one_cafe_trip: Cannot fast travel outside gate.", env.console @@ -271,7 +271,7 @@ void do_one_cafe_trip( if (travel_status != FastTravelState::SUCCESS){ stats.errors++; env.update_stats(); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "do_one_cafe_trip: Cannot fast travel to cafe.", env.console diff --git a/SerialPrograms/Source/PokemonLZA/Programs/ShinyHunting/PokemonLZA_WildZoneEntrance.cpp b/SerialPrograms/Source/PokemonLZA/Programs/ShinyHunting/PokemonLZA_WildZoneEntrance.cpp index 185d8c248f..a9ffdb4ea4 100644 --- a/SerialPrograms/Source/PokemonLZA/Programs/ShinyHunting/PokemonLZA_WildZoneEntrance.cpp +++ b/SerialPrograms/Source/PokemonLZA/Programs/ShinyHunting/PokemonLZA_WildZoneEntrance.cpp @@ -8,7 +8,7 @@ #include "Common/Cpp/Time.h" #include "CommonFramework/StaticGlobals.h" #include "CommonFramework/GlobalSettingsPanel.h" -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/ProgramStats/StatsTracking.h" #include "CommonFramework/Notifications/ProgramNotifications.h" #include "CommonFramework/Globals.h" @@ -189,7 +189,7 @@ void go_to_entrance( } ret = run_towards_gate_with_A_button(env.console, context, joystick_x, +1, 10s); if (ret != 0){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "go_to_entrance(): Cannot reach gate from outside after day/night change.", env.console @@ -197,7 +197,7 @@ void go_to_entrance( } break; default: - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "go_to_entrance(): Cannot reach gate from outside.", env.console @@ -216,7 +216,7 @@ void fast_travel_outside_zone( ){ if (!map_already_opened){ if (!open_map(env.console, context, to_max_zoom_level_on_map, true)){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "fast_travel_outside_zone(): Fast travel disabled from supposedly outside the entrance." + extra_error_msg, env.console @@ -228,7 +228,7 @@ void fast_travel_outside_zone( FastTravelState travel_status = fly_from_map(env.console, context); if (travel_status != FastTravelState::SUCCESS){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "fast_travel_outside_zone(): After moving map cursor, cannot fast travel to the zone." + extra_error_msg, env.console @@ -293,7 +293,7 @@ void leave_zone_and_reset_spawns( travel_status = fly_from_map(env.console, context); if (travel_status != FastTravelState::SUCCESS){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "leave_zone_and_reset_spawns(): Cannot fast travel to zone from outside the entrance.", env.console @@ -343,7 +343,7 @@ void leave_zone_and_reset_spawns( env.console.overlay().add_log("Running Back"); joystick_y = -1; }else{ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "leave_zone_and_reset_spawns(): Facing direction after day/night change is wrong: " + tostr_fixed(direction_change, 0) + " deg", env.console diff --git a/SerialPrograms/Source/PokemonPokopia/Programs/PokemonPokopia_CloudIslandReset.cpp b/SerialPrograms/Source/PokemonPokopia/Programs/PokemonPokopia_CloudIslandReset.cpp index 3faf3793c9..fe89639faa 100644 --- a/SerialPrograms/Source/PokemonPokopia/Programs/PokemonPokopia_CloudIslandReset.cpp +++ b/SerialPrograms/Source/PokemonPokopia/Programs/PokemonPokopia_CloudIslandReset.cpp @@ -5,7 +5,7 @@ */ //#include "CommonFramework/Logging/Logger.h" -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/ProgramStats/StatsTracking.h" #include "CommonFramework/Tools/ErrorDumper.h" #include "CommonTools/Async/InferenceRoutines.h" @@ -141,7 +141,7 @@ void CloudIslandReset::delete_cloud_island_save(SingleSwitchProgramEnvironment& env.console.log("Failed to detect settings menu loaded"); stats.errors++; env.update_stats(); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "delete_cloud_island_save() failed to detect settings menu loaded", env.console @@ -160,7 +160,7 @@ void CloudIslandReset::delete_cloud_island_save(SingleSwitchProgramEnvironment& env.console.log("Failed to navigate to delete save option"); stats.errors++; env.update_stats(); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "delete_cloud_island_save() failed to navigate to delete save option", env.console @@ -225,7 +225,7 @@ void CloudIslandReset::create_cloud_island_after_delete(SingleSwitchProgramEnvir env.console.log("Failed to navigate through create island menu"); stats.errors++; env.update_stats(); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "create_cloud_island_after_delete() failed to navigate through create island menu", env.console @@ -249,7 +249,7 @@ void CloudIslandReset::create_cloud_island_after_delete(SingleSwitchProgramEnvir env.console.log("Failed to detect travelling to new cloud island"); stats.errors++; env.update_stats(); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "create_cloud_island_after_delete() failed to detect travelling to new cloud island", env.console @@ -346,7 +346,7 @@ bool CloudIslandReset::buy_recipes(SingleSwitchProgramEnvironment& env, ProContr ); if (ret != 0){ env.console.log("Failed to read coin count in shop menu"); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "buy_recipes() failed to read coin count in shop menu", env.console @@ -401,7 +401,7 @@ void CloudIslandReset::leave_cloud_island(SingleSwitchProgramEnvironment& env, P env.console.log("Failed to detect leaving cloud island"); stats.errors++; env.update_stats(); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "leave_cloud_island() failed to detect leaving cloud island", env.console diff --git a/SerialPrograms/Source/PokemonPokopia/Programs/PokemonPokopia_DailyFarmer.cpp b/SerialPrograms/Source/PokemonPokopia/Programs/PokemonPokopia_DailyFarmer.cpp index 5ec81c7f6b..20c9664e54 100644 --- a/SerialPrograms/Source/PokemonPokopia/Programs/PokemonPokopia_DailyFarmer.cpp +++ b/SerialPrograms/Source/PokemonPokopia/Programs/PokemonPokopia_DailyFarmer.cpp @@ -6,7 +6,7 @@ //#include "CommonFramework/Logging/Logger.h" #include -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/VideoPipeline/VideoFeed.h" #include "CommonFramework/ProgramStats/StatsTracking.h" #include "CommonFramework/Tools/ErrorDumper.h" @@ -134,7 +134,7 @@ void DailyFarmer::go_to_date_menu(SingleSwitchProgramEnvironment& env, ProContro env.console.log("Successfully navigated to date change menu"); return; } - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Failed to navigate to date change menu", env.console diff --git a/SerialPrograms/Source/PokemonPokopia/Programs/PokemonPokopia_PCNavigation.cpp b/SerialPrograms/Source/PokemonPokopia/Programs/PokemonPokopia_PCNavigation.cpp index 395b96a2b3..b1f405a276 100644 --- a/SerialPrograms/Source/PokemonPokopia/Programs/PokemonPokopia_PCNavigation.cpp +++ b/SerialPrograms/Source/PokemonPokopia/Programs/PokemonPokopia_PCNavigation.cpp @@ -4,7 +4,7 @@ * */ -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/VideoPipeline/VideoFeed.h" #include "CommonTools/Async/InferenceRoutines.h" #include "NintendoSwitch/Commands/NintendoSwitch_Commands_PushButtons.h" @@ -374,7 +374,7 @@ void wait_for_overworld(ConsoleHandle& console, ProControllerContext& context){ ); if (ret != 0){ console.log("Failed to detect overworld"); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "wait_for_overworld() failed to detect overworld", console @@ -396,7 +396,7 @@ void mash_until_overworld(ConsoleHandle& console, ProControllerContext& context) ); if (ret != 0){ console.log("Failed to detect overworld"); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "mash_until_overworld() failed to detect overworld", console @@ -505,7 +505,7 @@ void access_pc_from_overworld(ConsoleHandle& console, ProControllerContext& cont if (ret == 0){ console.log("Successfully navigated up to main PC menu from stamp redeem prompt"); if (stop_on_stamp_card){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "access_pc_from_overworld() failed to find stamp card menu after redeeming stamps", console @@ -542,7 +542,7 @@ void access_pc_from_overworld(ConsoleHandle& console, ProControllerContext& cont console.log("Failed to detect A button prompt, attempting to reposition and retry... (attempt " + std::to_string(i+1) + ")"); } } - OperationFailedException( + throw OperationFailedExceptionWithScreenshot( ErrorReport::SEND_ERROR_REPORT, "access_pc_from_overworld() failed to open PC", console @@ -566,7 +566,7 @@ void exit_pc(ConsoleHandle& console, ProControllerContext& context){ ); if (ret != 0){ console.log("Failed to detect return to overworld"); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "exit_pc() failed to detect return to overworld", console @@ -583,7 +583,7 @@ void open_menu_option(ConsoleHandle& console, ProControllerContext& context, PCM ); if (!set_menu_option(console, context, option)){ console.log("Failed to set menu option"); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "open_menu_option() failed to set menu option", console @@ -618,7 +618,7 @@ void open_menu_option(ConsoleHandle& console, ProControllerContext& context, PCM } } console.log("Failed to open PC menu option"); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "open_menu_option() failed to open PC menu option", console @@ -641,7 +641,7 @@ void generic_select_and_open( if (!generic_navigate_to_target(console, context, option_boxes, target_index, arrow_type)){ console.log("Failed to navigate and confirm the target"); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "generic_select_and_open() failed to navigate and confirm the target", console @@ -659,7 +659,7 @@ void generic_select_and_open( } } console.log("Failed to open target option"); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "generic_select_and_open() failed to open target option", console @@ -695,7 +695,7 @@ void continue_until_prompt( ); if (ret != 0){ console.log("Failed to detect prompt"); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "continue_until_prompt() failed to detect prompt", console @@ -757,7 +757,7 @@ void buy_item(ConsoleHandle& console, ProControllerContext& context, int item_in ); if (ret != 0){ console.log("Failed to detect shop after purchase"); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "buy_item() failed to detect shop after purchase", console @@ -832,7 +832,7 @@ bool add_stamp(ConsoleHandle& console, ProControllerContext& context, SelectionA return true; } } - OperationFailedException( + throw OperationFailedExceptionWithScreenshot( ErrorReport::SEND_ERROR_REPORT, "add_stamp() failed to add stamp", console @@ -859,7 +859,7 @@ void replace_stamp( } } console.log("Failed to replace stamp"); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "replace_stamp() failed to replace stamp", console @@ -880,7 +880,7 @@ void move_to_next_stamp(ConsoleHandle& console, ProControllerContext& context, S ); if (ret != 0) { console.log("Failed to detect selector after moving to next stamp"); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "move_to_next_stamp() failed to detect selector after moving to next stamp", console @@ -893,7 +893,7 @@ void move_to_next_stamp(ConsoleHandle& console, ProControllerContext& context, S } } console.log("Failed to move selector to next stamp"); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "move_to_next_stamp() failed to move selector to next stamp", console diff --git a/SerialPrograms/Source/PokemonRSE/PokemonRSE_Navigation.cpp b/SerialPrograms/Source/PokemonRSE/PokemonRSE_Navigation.cpp index 9c1b3ee507..bfeec80092 100644 --- a/SerialPrograms/Source/PokemonRSE/PokemonRSE_Navigation.cpp +++ b/SerialPrograms/Source/PokemonRSE/PokemonRSE_Navigation.cpp @@ -6,7 +6,7 @@ * */ -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonTools/Random.h" #include "CommonTools/Async/InferenceRoutines.h" #include "CommonTools/StartupChecks/StartProgramChecks.h" @@ -152,7 +152,7 @@ uint64_t soft_reset(ConsoleHandle& console, ProControllerContext& context){ return errors; } } - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "soft_reset(): Failed to reset after 5 attempts.", console @@ -177,7 +177,7 @@ void flee_battle(VideoStream& stream, ProControllerContext& context){ if (ret2 == 0){ stream.log("Running away..."); }else{ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "handle_encounter(): Unable to navigate to flee button.", stream @@ -198,7 +198,7 @@ void flee_battle(VideoStream& stream, ProControllerContext& context){ if (ret3 == 0){ stream.log("Successfully ran from battle."); }else{ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "handle_encounter(): Unable to flee from battle.", stream @@ -225,7 +225,7 @@ bool handle_encounter(ConsoleHandle& console, ProControllerContext& context, boo if (ret == 0){ console.log("Advance arrow detected."); }else{ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "handle_encounter(): Did not detect battle start.", console @@ -257,7 +257,7 @@ bool handle_encounter(ConsoleHandle& console, ProControllerContext& context, boo if (ret == 0){ console.log("Battle menu detecteed!"); }else{ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "handle_encounter(): Did not detect battle menu.", console diff --git a/SerialPrograms/Source/PokemonRSE/Programs/ShinyHunting/PokemonRSE_AudioStarterReset.cpp b/SerialPrograms/Source/PokemonRSE/Programs/ShinyHunting/PokemonRSE_AudioStarterReset.cpp index c4ddd93f8e..e587c17f13 100644 --- a/SerialPrograms/Source/PokemonRSE/Programs/ShinyHunting/PokemonRSE_AudioStarterReset.cpp +++ b/SerialPrograms/Source/PokemonRSE/Programs/ShinyHunting/PokemonRSE_AudioStarterReset.cpp @@ -4,7 +4,7 @@ * */ -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/ProgramStats/StatsTracking.h" #include "CommonFramework/Notifications/ProgramNotifications.h" #include "CommonFramework/VideoPipeline/VideoFeed.h" @@ -134,7 +134,7 @@ void AudioStarterReset::program(SingleSwitchProgramEnvironment& env, ProControll env.log("Failed to open bag after 10 attempts.", COLOR_RED); stats.errors++; env.update_stats(); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Failed to open bag after 10 attempts.", env.console @@ -162,7 +162,7 @@ void AudioStarterReset::program(SingleSwitchProgramEnvironment& env, ProControll env.log("Invalid target selected."); stats.errors++; env.update_stats(); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "AudioStarterReset: Invalid target.", env.console @@ -188,7 +188,7 @@ void AudioStarterReset::program(SingleSwitchProgramEnvironment& env, ProControll env.log("Failed to start battle after 10 attempts.", COLOR_RED); stats.errors++; env.update_stats(); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Failed to start battle after 10 attempts.", env.console @@ -215,7 +215,7 @@ void AudioStarterReset::program(SingleSwitchProgramEnvironment& env, ProControll env.log("Battle Advance arrow was not detected."); stats.errors++; env.update_stats(); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Battle Advance arrow was not detected.", env.console @@ -268,7 +268,7 @@ void AudioStarterReset::program(SingleSwitchProgramEnvironment& env, ProControll env.log("Battle menu was not detected."); stats.errors++; env.update_stats(); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Battle menu was not detected.", env.console diff --git a/SerialPrograms/Source/PokemonRSE/Programs/ShinyHunting/PokemonRSE_GiftReset.cpp b/SerialPrograms/Source/PokemonRSE/Programs/ShinyHunting/PokemonRSE_GiftReset.cpp index b9513ff34d..852cc7bbc9 100644 --- a/SerialPrograms/Source/PokemonRSE/Programs/ShinyHunting/PokemonRSE_GiftReset.cpp +++ b/SerialPrograms/Source/PokemonRSE/Programs/ShinyHunting/PokemonRSE_GiftReset.cpp @@ -4,7 +4,7 @@ * */ -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/ProgramStats/StatsTracking.h" #include "CommonFramework/Notifications/ProgramNotifications.h" #include "CommonFramework/ProgramStats/StatsTracking.h" @@ -108,7 +108,7 @@ void GiftReset::obtain_pokemon(SingleSwitchProgramEnvironment& env, ProControlle stats.errors++; env.update_stats(); env.log("obtain_pokemon(): Unable to start starter dialog after 10 attempts.", COLOR_RED); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "obtain_pokemon(): Unable to start starter dialog after 10 attempts.", env.console @@ -165,7 +165,7 @@ void GiftReset::obtain_pokemon(SingleSwitchProgramEnvironment& env, ProControlle default: stats.errors++; env.update_stats(); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "obtain_starter(): No recognized state after 10 seconds.", env.console @@ -343,7 +343,7 @@ uint64_t GiftReset::open_summary(SingleSwitchProgramEnvironment& env, ProControl pbf_mash_button(context, BUTTON_B, 10000ms); } } - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "open_summary(): Failed to open party summary after 5 attempts.", env.console @@ -377,7 +377,7 @@ void GiftReset::program(SingleSwitchProgramEnvironment& env, ProControllerContex default: stats.errors++; env.update_stats(); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "GiftReset: Invalid target selection.", env.console diff --git a/SerialPrograms/Source/PokemonRSE/Programs/ShinyHunting/PokemonRSE_LegendaryRunAway-Emerald.cpp b/SerialPrograms/Source/PokemonRSE/Programs/ShinyHunting/PokemonRSE_LegendaryRunAway-Emerald.cpp index 5f67d71840..4921984879 100644 --- a/SerialPrograms/Source/PokemonRSE/Programs/ShinyHunting/PokemonRSE_LegendaryRunAway-Emerald.cpp +++ b/SerialPrograms/Source/PokemonRSE/Programs/ShinyHunting/PokemonRSE_LegendaryRunAway-Emerald.cpp @@ -5,7 +5,7 @@ */ //#include "Common/Cpp/PrettyPrint.h" -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonTools/Async/InferenceRoutines.h" #include "CommonTools/StartupChecks/StartProgramChecks.h" #include "CommonFramework/Notifications/ProgramNotifications.h" @@ -171,7 +171,7 @@ void LegendaryRunAwayEmerald::reset_regi(SingleSwitchProgramEnvironment& env, Pr env.log("Failed to exit area.", COLOR_RED); stats.errors++; env.update_stats(); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Failed to exit area.", env.console @@ -196,7 +196,7 @@ void LegendaryRunAwayEmerald::reset_regi(SingleSwitchProgramEnvironment& env, Pr env.log("Failed to enter area.", COLOR_RED); stats.errors++; env.update_stats(); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Failed to enter area.", env.console @@ -258,7 +258,7 @@ void LegendaryRunAwayEmerald::reset_groudon(SingleSwitchProgramEnvironment& env, env.log("Failed to exit area.", COLOR_RED); stats.errors++; env.update_stats(); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Failed to exit area.", env.console @@ -285,7 +285,7 @@ void LegendaryRunAwayEmerald::reset_groudon(SingleSwitchProgramEnvironment& env, stats.errors++; env.update_stats(); env.log("Failed to enter area.", COLOR_RED); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Failed to enter area.", env.console @@ -366,7 +366,7 @@ void LegendaryRunAwayEmerald::reset_kyogre(SingleSwitchProgramEnvironment& env, env.log("Failed to exit area.", COLOR_RED); stats.errors++; env.update_stats(); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Failed to exit area.", env.console @@ -393,7 +393,7 @@ void LegendaryRunAwayEmerald::reset_kyogre(SingleSwitchProgramEnvironment& env, env.log("Failed to enter area.", COLOR_RED); stats.errors++; env.update_stats(); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Failed to enter area.", env.console @@ -453,7 +453,7 @@ void LegendaryRunAwayEmerald::reset_hooh(SingleSwitchProgramEnvironment& env, Pr env.log("Failed to exit area.", COLOR_RED); stats.errors++; env.update_stats(); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Failed to exit area.", env.console @@ -483,7 +483,7 @@ void LegendaryRunAwayEmerald::reset_hooh(SingleSwitchProgramEnvironment& env, Pr env.log("Failed to enter area.", COLOR_RED); stats.errors++; env.update_stats(); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Failed to enter area.", env.console @@ -528,7 +528,7 @@ void LegendaryRunAwayEmerald::reset_lugia(SingleSwitchProgramEnvironment& env, P env.log("Failed to exit area.", COLOR_RED); stats.errors++; env.update_stats(); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Failed to exit area.", env.console @@ -558,7 +558,7 @@ void LegendaryRunAwayEmerald::reset_lugia(SingleSwitchProgramEnvironment& env, P env.log("Failed to enter area.", COLOR_RED); stats.errors++; env.update_stats(); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Failed to enter area.", env.console @@ -629,7 +629,7 @@ void LegendaryRunAwayEmerald::program(SingleSwitchProgramEnvironment& env, ProCo env.log("Failed to start battle after 5 attempts.", COLOR_RED); stats.errors++; env.update_stats(); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Failed to start battle after 5 attempts.", env.console @@ -683,7 +683,7 @@ void LegendaryRunAwayEmerald::program(SingleSwitchProgramEnvironment& env, ProCo reset_lugia(env, context); break; default: - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Invalid target!", env.console diff --git a/SerialPrograms/Source/PokemonRSE/Programs/ShinyHunting/PokemonRSE_ShinyHunt-Deoxys.cpp b/SerialPrograms/Source/PokemonRSE/Programs/ShinyHunting/PokemonRSE_ShinyHunt-Deoxys.cpp index 44030a3933..937273a918 100644 --- a/SerialPrograms/Source/PokemonRSE/Programs/ShinyHunting/PokemonRSE_ShinyHunt-Deoxys.cpp +++ b/SerialPrograms/Source/PokemonRSE/Programs/ShinyHunting/PokemonRSE_ShinyHunt-Deoxys.cpp @@ -5,7 +5,7 @@ */ //#include "Common/Cpp/PrettyPrint.h" -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/Notifications/ProgramNotifications.h" #include "CommonFramework/ProgramStats/StatsTracking.h" #include "CommonFramework/VideoPipeline/VideoFeed.h" @@ -238,7 +238,7 @@ void ShinyHuntDeoxys::program(SingleSwitchProgramEnvironment& env, ProController default: stats.errors++; env.update_stats(); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Invalid starting position selected.", env.console @@ -266,7 +266,7 @@ void ShinyHuntDeoxys::program(SingleSwitchProgramEnvironment& env, ProController env.log("Failed to start battle after 5 attempts.", COLOR_RED); stats.errors++; env.update_stats(); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Failed to start battle after 5 attempts.", env.console diff --git a/SerialPrograms/Source/PokemonRSE/Programs/ShinyHunting/PokemonRSE_ShinyHunt-Mew.cpp b/SerialPrograms/Source/PokemonRSE/Programs/ShinyHunting/PokemonRSE_ShinyHunt-Mew.cpp index 56bc590cc9..8cd47f70b6 100644 --- a/SerialPrograms/Source/PokemonRSE/Programs/ShinyHunting/PokemonRSE_ShinyHunt-Mew.cpp +++ b/SerialPrograms/Source/PokemonRSE/Programs/ShinyHunting/PokemonRSE_ShinyHunt-Mew.cpp @@ -5,7 +5,7 @@ */ //#include "Common/Cpp/PrettyPrint.h" -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/Notifications/ProgramNotifications.h" #include "CommonFramework/ProgramStats/StatsTracking.h" #include "CommonFramework/VideoPipeline/VideoFeed.h" @@ -131,7 +131,7 @@ void ShinyHuntMew::enter_mew(SingleSwitchProgramEnvironment& env, ProControllerC env.log("Failed to enter area.", COLOR_RED); stats.errors++; env.update_stats(); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Failed to enter area.", env.console @@ -184,7 +184,7 @@ void ShinyHuntMew::enter_mew(SingleSwitchProgramEnvironment& env, ProControllerC env.log("Failed to start battle after 5 attempts.", COLOR_RED); stats.errors++; env.update_stats(); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Failed to start battle after 5 attempts.", env.console @@ -222,7 +222,7 @@ void ShinyHuntMew::exit_mew(SingleSwitchProgramEnvironment& env, ProControllerCo env.log("Failed to exit area.", COLOR_RED); stats.errors++; env.update_stats(); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Failed to exit area.", env.console diff --git a/SerialPrograms/Source/PokemonRSE/Programs/ShinyHunting/PokemonRSE_StarterReset.cpp b/SerialPrograms/Source/PokemonRSE/Programs/ShinyHunting/PokemonRSE_StarterReset.cpp index 45b4835314..965855caf0 100644 --- a/SerialPrograms/Source/PokemonRSE/Programs/ShinyHunting/PokemonRSE_StarterReset.cpp +++ b/SerialPrograms/Source/PokemonRSE/Programs/ShinyHunting/PokemonRSE_StarterReset.cpp @@ -4,7 +4,7 @@ * */ -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/ProgramStats/StatsTracking.h" #include "CommonFramework/Notifications/ProgramNotifications.h" #include "CommonFramework/ProgramStats/StatsTracking.h" @@ -121,7 +121,7 @@ void StarterReset::program(SingleSwitchProgramEnvironment& env, ProControllerCon pbf_press_dpad(context, DPAD_RIGHT, 320ms, 800ms); break; default: - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "StarterReset: Invalid target.", env.console @@ -163,7 +163,7 @@ void StarterReset::program(SingleSwitchProgramEnvironment& env, ProControllerCon env.log("Entered party menu."); }else{ env.log("Timed out waiting to enter party menu.", COLOR_RED); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "StarterReset: Timed out waiting to enter party menu.", env.console diff --git a/SerialPrograms/Source/PokemonSV/Inference/Battles/PokemonSV_NormalBattleMenus.cpp b/SerialPrograms/Source/PokemonSV/Inference/Battles/PokemonSV_NormalBattleMenus.cpp index 856d62a815..7bd01f0fa7 100644 --- a/SerialPrograms/Source/PokemonSV/Inference/Battles/PokemonSV_NormalBattleMenus.cpp +++ b/SerialPrograms/Source/PokemonSV/Inference/Battles/PokemonSV_NormalBattleMenus.cpp @@ -6,7 +6,7 @@ #include "Common/Cpp/TestRunners/UnitTestDatabase.h" #include "CommonFramework/GlobalAutoPaths.h" -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/VideoPipeline/VideoFeed.h" #include "CommonFramework/Tools/ErrorDumper.h" #include "CommonFramework/Tools/DebugDumper.h" @@ -173,7 +173,7 @@ std::set read_singles_opponent( } } - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Unable to open status menu to read opponent name.", stream diff --git a/SerialPrograms/Source/PokemonSV/Inference/ItemPrinter/PokemonSV_ItemPrinterJobsDetector.cpp b/SerialPrograms/Source/PokemonSV/Inference/ItemPrinter/PokemonSV_ItemPrinterJobsDetector.cpp index 4ba3536794..04e56dd4c7 100644 --- a/SerialPrograms/Source/PokemonSV/Inference/ItemPrinter/PokemonSV_ItemPrinterJobsDetector.cpp +++ b/SerialPrograms/Source/PokemonSV/Inference/ItemPrinter/PokemonSV_ItemPrinterJobsDetector.cpp @@ -7,7 +7,7 @@ #include #include "Common/Cpp/Concurrency/SpinLock.h" #include "Common/Cpp/Concurrency/AsyncTask.h" -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/ImageTypes/ImageViewRGB32.h" #include "CommonFramework/ImageTypes/ImageRGB32.h" #include "CommonFramework/Tools/GlobalThreadPools.h" @@ -137,7 +137,7 @@ void ItemPrinterJobsDetector::set_print_jobs( pbf_press_button(context, BUTTON_R, 160ms, 240ms); } - throw_and_log( + throw_and_log( stream.logger(), ErrorReport::SEND_ERROR_REPORT, "Failed to set jobs after 10 tries.", &stream, diff --git a/SerialPrograms/Source/PokemonSV/Inference/ItemPrinter/PokemonSV_ItemPrinterMaterialDetector.cpp b/SerialPrograms/Source/PokemonSV/Inference/ItemPrinter/PokemonSV_ItemPrinterMaterialDetector.cpp index 7843e21ed3..2541308e49 100644 --- a/SerialPrograms/Source/PokemonSV/Inference/ItemPrinter/PokemonSV_ItemPrinterMaterialDetector.cpp +++ b/SerialPrograms/Source/PokemonSV/Inference/ItemPrinter/PokemonSV_ItemPrinterMaterialDetector.cpp @@ -6,7 +6,7 @@ #include #include "Common/Cpp/Concurrency/SpinLock.h" -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/ImageTypes/ImageViewRGB32.h" #include "CommonFramework/ImageTypes/ImageRGB32.h" #include "CommonFramework/ImageTools/ImageStats.h" @@ -190,7 +190,7 @@ int8_t ItemPrinterMaterialDetector::find_happiny_dust_row_index( pbf_press_dpad(context, DPAD_RIGHT, 160ms, 240ms); } - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Failed to find Happiny dust after multiple attempts.", stream @@ -223,7 +223,7 @@ int16_t ItemPrinterMaterialDetector::find_highest_quantity_of_value_68(VideoStre } if (!seen_material_value_68){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "find_highest_quantity_of_value_68: Failed to find any material with value of 68, after multiple attempts.", stream @@ -260,7 +260,7 @@ std::string ItemPrinterMaterialDetector::detect_material_name( } if (results.size() > 1){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "ItemPrinterMaterialDetector::detect_material_name(): Unable to read selected item. Ambiguous or multiple results.\n" + language_warning(m_language), stream diff --git a/SerialPrograms/Source/PokemonSV/Inference/Overworld/PokemonSV_AreaZeroSkyDetector.cpp b/SerialPrograms/Source/PokemonSV/Inference/Overworld/PokemonSV_AreaZeroSkyDetector.cpp index 9b3912e351..c4172751d0 100644 --- a/SerialPrograms/Source/PokemonSV/Inference/Overworld/PokemonSV_AreaZeroSkyDetector.cpp +++ b/SerialPrograms/Source/PokemonSV/Inference/Overworld/PokemonSV_AreaZeroSkyDetector.cpp @@ -5,7 +5,7 @@ */ #include "Kernels/Waterfill/Kernels_Waterfill_Session.h" -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/Tools/ProgramEnvironment.h" #include "CommonTools/Images/BinaryImage_FilterRgb32.h" #include "CommonTools/Async/InterruptableCommands.h" @@ -118,7 +118,7 @@ void find_and_center_on_sky( WallClock start = current_time(); while (true){ if (current_time() - start > std::chrono::minutes(1)){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::NO_ERROR_REPORT, "Failed to find the sky after 1 minute. (state = " + std::to_string((int)state) + ")", stream diff --git a/SerialPrograms/Source/PokemonSV/Inference/Overworld/PokemonSV_DirectionDetector.cpp b/SerialPrograms/Source/PokemonSV/Inference/Overworld/PokemonSV_DirectionDetector.cpp index c6264485ae..17375a8b48 100644 --- a/SerialPrograms/Source/PokemonSV/Inference/Overworld/PokemonSV_DirectionDetector.cpp +++ b/SerialPrograms/Source/PokemonSV/Inference/Overworld/PokemonSV_DirectionDetector.cpp @@ -4,7 +4,7 @@ * */ -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "Kernels/Waterfill/Kernels_Waterfill_Types.h" #include "CommonFramework/ImageTypes/ImageViewRGB32.h" #include "CommonFramework/Tools/DebugDumper.h" @@ -177,7 +177,7 @@ void DirectionDetector::change_direction( double current = get_current_direction(stream, screen); if (current < 0){ if (throw_if_fail){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "change_direction(): Unable to detect current direction.", stream diff --git a/SerialPrograms/Source/PokemonSV/Inference/PokemonSV_MainMenuDetector.cpp b/SerialPrograms/Source/PokemonSV/Inference/PokemonSV_MainMenuDetector.cpp index d8a65a24c2..fe28354727 100644 --- a/SerialPrograms/Source/PokemonSV/Inference/PokemonSV_MainMenuDetector.cpp +++ b/SerialPrograms/Source/PokemonSV/Inference/PokemonSV_MainMenuDetector.cpp @@ -5,7 +5,7 @@ */ #include "Common/Cpp/Exceptions.h" -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/VideoPipeline/VideoFeed.h" #include "CommonTools/Images/SolidColorTest.h" #include "NintendoSwitch/Commands/NintendoSwitch_Commands_PushButtons.h" @@ -131,7 +131,7 @@ bool MainMenuDetector::move_cursor( if (current.first == MenuSide::NONE){ consecutive_detection_fails++; if (consecutive_detection_fails > 10){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "MainMenuDetector::move_cursor(): Unable to detect menu.", stream, diff --git a/SerialPrograms/Source/PokemonSV/Inference/PokemonSV_ZeroGateWarpPromptDetector.cpp b/SerialPrograms/Source/PokemonSV/Inference/PokemonSV_ZeroGateWarpPromptDetector.cpp index a01937e7df..4b841bfeb7 100644 --- a/SerialPrograms/Source/PokemonSV/Inference/PokemonSV_ZeroGateWarpPromptDetector.cpp +++ b/SerialPrograms/Source/PokemonSV/Inference/PokemonSV_ZeroGateWarpPromptDetector.cpp @@ -4,7 +4,7 @@ * */ -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/VideoPipeline/VideoFeed.h" #include "NintendoSwitch/Commands/NintendoSwitch_Commands_PushButtons.h" #include "PokemonSV_ZeroGateWarpPromptDetector.h" @@ -61,7 +61,7 @@ bool ZeroGateWarpPromptDetector::move_cursor( if (current < 0){ consecutive_detection_fails++; if (consecutive_detection_fails > 10){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "ZeroGateWarpPromptDetector::move_cursor(): Unable to detect cursor.", stream, @@ -74,7 +74,7 @@ bool ZeroGateWarpPromptDetector::move_cursor( consecutive_detection_fails = 0; if (moves >= 10){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Unable to move to target after 10 moves.", stream, diff --git a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory.cpp b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory.cpp index 1b3ecc148e..ae00085d42 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory.cpp @@ -13,7 +13,7 @@ #endif -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/StaticGlobals.h" #include "CommonFramework/GlobalAutoPaths.h" #include "CommonFramework/VideoPipeline/VideoFeed.h" @@ -1350,7 +1350,7 @@ void AutoStory::program(SingleSwitchProgramEnvironment& env, ProControllerContex DirectionDetector direction; double current = direction.get_current_direction(env.console, env.console.video().snapshot()); if (current < 0){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "change_direction(): Unable to detect current direction. Something (e.g. a marker) is covering the N symbol on the minimap. " "Try moving the marker on the map.", diff --git a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStoryTools.cpp b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStoryTools.cpp index e52cd22ac9..3df26bb368 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStoryTools.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStoryTools.cpp @@ -6,7 +6,7 @@ #include "Common/Cpp/PrettyPrint.h" #include "CommonFramework/ErrorReports/ErrorReports.h" -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/Exceptions/UnexpectedBattleException.h" #include "CommonFramework/Notifications/ProgramNotifications.h" #include "CommonFramework/ImageTools/ImageBoxes.h" @@ -67,7 +67,7 @@ void clear_tutorial(VideoStream& stream, ProControllerContext& context, uint16_t default: stream.log("clear_tutorial: Timed out."); if(!seen_tutorial){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "clear_tutorial(): Tutorial screen never detected.", stream @@ -87,7 +87,7 @@ void clear_dialog(VideoStream& stream, ProControllerContext& context, WallClock start = current_time(); while (true){ if (current_time() - start > std::chrono::minutes(5)){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "clear_dialog(): Failed to clear dialog after 5 minutes.", stream @@ -171,7 +171,7 @@ void clear_dialog(VideoStream& stream, ProControllerContext& context, if (seen_dialog && mode == ClearDialogMode::STOP_TIMEOUT){ return; } - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "clear_dialog(): Timed out. Did not detect dialog or did not detect the expected stop condition.", stream @@ -429,7 +429,7 @@ void overworld_navigation( return; } if (stop_condition == NavigationStopCondition::STOP_MARKER){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "overworld_navigation(): Unexpectedly detected dialog.", stream @@ -448,7 +448,7 @@ void overworld_navigation( if (stop_condition == NavigationStopCondition::STOP_TIME){ return; } - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "overworld_navigation(): Timed out. Did not detect expected stop condition.", stream @@ -550,7 +550,7 @@ void confirm_lead_pokemon_moves(SingleSwitchProgramEnvironment& env, ProControll if (move_0 != "moonblast" || move_1 != "mystical-fire" || move_2 != "psychic" || move_3 != "misty-terrain"){ stream.log("Lead Pokemon's moves are wrong. They are supposed to be: Moonblast, Mystical Fire, Psychic, Misty Terrain."); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "We expect your lead Pokemon to be a Gardevoir with moves in this order: Moonblast, Mystical Fire, Psychic, Misty Terrain. " "But we see something else instead. If you confirm that your lead Gardevoir does indeed have these moves in this order, " @@ -569,7 +569,7 @@ void confirm_minimap_unlocked(SingleSwitchProgramEnvironment& env, ProController direction.change_direction(env.program_info(), env.console, context, 3.02); pbf_press_button(context, BUTTON_L, 200ms, 200ms); }catch (OperationFailedException&){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "confirm_minimap_unlocked(): Unable to confirm that the minimap is unlocked. Likely because the direction cannot be detected. " "If you manually confirm that the minimap is unlocked, you can disable this precheck in the program setting \"Pre-check: Ensure the minimap is unlocked\".", @@ -850,7 +850,7 @@ void do_action_and_monitor_for_battles_early( }); // if no battle seen, then throw Exception. - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "do_action_and_monitor_for_battles_early(): Expected to see a battle, but didn't. Possible false positive on NoMinimapWatcher.", stream @@ -886,7 +886,7 @@ void do_action_until_dialog( stream.log("do_action_until_dialog(): Detected dialog."); return; default: - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "do_action_until_dialog(): Finished action. Did not detect dialog.", stream @@ -944,7 +944,7 @@ void do_action_and_monitor_for_overworld( // successfully completed action detecting the overworld return; }else if (ret == 0){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "do_action_and_monitor_for_overworld(): Failed to complete action. Detected overworld.", stream @@ -976,7 +976,7 @@ void handle_when_stationary_in_overworld( size_t num_failures = 0; while (true){ if (current_time() - start > std::chrono::minutes(minutes_timeout)){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "handle_when_stationary_in_overworld(): Failed to complete action after " + std::to_string(minutes_timeout) + " minutes.", stream @@ -1000,7 +1000,7 @@ void handle_when_stationary_in_overworld( stream.log("Detected stationary overworld."); num_failures++; if (num_failures > max_failures){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "handle_when_stationary_in_overworld(): Failed to complete action within " + std::to_string(max_failures) + " attempts.", stream @@ -1063,7 +1063,7 @@ void wait_for_gradient_arrow( if (ret == 0){ stream.log("Gradient arrow detected."); }else{ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Failed to detect gradient arrow.", stream @@ -1087,7 +1087,7 @@ void wait_for_overworld( if (ret == 0){ stream.log("Overworld detected."); }else{ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Failed to detect overworld.", stream @@ -1116,7 +1116,7 @@ void press_A_until_dialog( if (ret == 0){ stream.log("press_A_until_dialog: Detected dialog."); }else{ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "press_A_until_dialog(): Unable to detect dialog after 10 button presses.", stream @@ -1168,7 +1168,7 @@ void get_on_or_off_ride(const ProgramInfo& info, VideoStream& stream, ProControl WallClock start = current_time(); while (get_on != is_ride_active(info, stream, context)){ if (current_time() - start > std::chrono::minutes(3)){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "get_on_or_off_ride(): Failed to get on/off ride after 3 minutes.", stream @@ -1205,7 +1205,7 @@ void realign_player_from_landmark( while (true){ if (current_time() - start > std::chrono::minutes(5)){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "realign_player_from_landmark(): Failed to realign player after 5 minutes.", stream @@ -1242,7 +1242,7 @@ void realign_player_from_landmark( // move cursor to pokecenter double push_scale = 0.29 * adjustment_table[try_count]; if (!detect_closest_flypoint_and_move_map_cursor_there(info, stream, context, FlyPoint::POKECENTER, push_scale)){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "realign_player_from_landmark(): No visible pokecenter found on map.", stream @@ -1287,7 +1287,7 @@ void realign_player_from_landmark( }catch (OperationFailedException&){ try_count++; if (try_count >= MAX_TRY_COUNT){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "fly_to_closest_pokecenter_on_map(): At min warpable map level, pokecenter was detected, but failed to fly there.", stream @@ -1308,7 +1308,7 @@ void confirm_cursor_centered_on_pokecenter(const ProgramInfo& info, VideoStream& ImageFloatBox center_cursor{0.484, 0.472, 0.030, 0.053}; MapPokeCenterIconDetector pokecenter(COLOR_RED, center_cursor); if (!pokecenter.detect(stream.video().snapshot())){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "confirm_cursor_centered_on_pokecenter(): Cursor is not centered on a pokecenter.", stream @@ -1335,7 +1335,7 @@ void move_cursor_towards_flypoint_and_go_there( while (true){ if (current_time() - start > std::chrono::minutes(5)){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "move_cursor_towards_flypoint_and_go_there(): Failed to fly after 5 minutes.", stream @@ -1371,7 +1371,7 @@ void move_cursor_towards_flypoint_and_go_there( double push_scale = 0.29 * adjustment_table[try_count]; if (!fly_to_visible_closest_flypoint_cur_zoom_level(info, stream, context, fly_point, push_scale)){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "move_cursor_towards_flypoint_and_go_there(): No visible pokecenter found on map.", stream @@ -1385,7 +1385,7 @@ void move_cursor_towards_flypoint_and_go_there( }catch (OperationFailedException&){ try_count++; if (try_count >= MAX_TRY_COUNT){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "move_cursor_towards_flypoint_and_go_there(): At given zoom level, pokecenter was detected, but failed to fly there.", stream @@ -1414,7 +1414,7 @@ void check_num_sunflora_found(SingleSwitchProgramEnvironment& env, ProController if (number_string.compare(0, expected_number_string.size(), expected_number_string) == 0){ env.console.log("Number of sunflora found: " + expected_number_string); }else{ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "The number of sunflora found is different than expected.", env.console @@ -1470,7 +1470,7 @@ void checkpoint_reattempt_loop( } if (i > max_attempts){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Autostory checkpoint failed " + std::to_string(max_attempts) + " times.\n" + checkpoint_text + "\n" @@ -1530,7 +1530,7 @@ void checkpoint_reattempt_loop_tutorial( } if (i > max_attempts){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Autostory checkpoint failed " + std::to_string(max_attempts) + " times.\n" "Make sure you selected the correct Start Point, and your character is in the exactly correct starting position." @@ -1646,7 +1646,7 @@ void move_forward_until_yolo_object_above_min_size( } if (forward_move_count > 50){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "move_forward_until_yolo_object_above_min_size(): Unable to reach target object after many attempts.", env.console @@ -1655,7 +1655,7 @@ void move_forward_until_yolo_object_above_min_size( } if (!seen_object){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "move_forward_until_yolo_object_above_min_size(): Never detected the yolo object.", env.console @@ -1712,7 +1712,7 @@ void move_player_until_yolo_object_detected( round_num++; if (round_num > max_rounds){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "move_player_until_yolo_object_detected(): Unable to detect target object.", env.console @@ -1766,7 +1766,7 @@ void move_forward_until_yolo_object_not_detected( round_num++; if (round_num > max_rounds){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "move_forward_until_yolo_object_not_detected(): Unable to walk away from target object.", env.console @@ -1861,7 +1861,7 @@ bool move_player_to_realign_via_yolo( } if (!seen_object){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "move_player_to_realign_via_yolo(): Never detected the yolo object.", env.console @@ -1927,7 +1927,7 @@ void move_camera_until_yolo_object_detected( } round_num++; if (round_num > max_rounds){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "move_camera_until_yolo_object_detected(): Unable to detect target object.", env.console @@ -1965,7 +1965,7 @@ void confirm_titan_battle(SingleSwitchProgramEnvironment& env, ProControllerCont env.console.log("Confirmed Titan battle."); }else{ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "confirm_titan_battle(): Unable to confirm Titan battle.", env.console diff --git a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_01.cpp b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_01.cpp index b823d2e12f..1032aa1a8f 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_01.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_01.cpp @@ -4,7 +4,7 @@ * */ -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/Notifications/ProgramNotifications.h" #include "CommonFramework/VideoPipeline/VideoOverlay.h" #include "CommonTools/Async/InferenceRoutines.h" @@ -254,7 +254,7 @@ void checkpoint_03( {tutorial} ); if (ret < 0){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Stuck trying to clear auto heal tutorial.", env.console diff --git a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_04.cpp b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_04.cpp index 2fce30575e..c07633b598 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_04.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_04.cpp @@ -4,7 +4,7 @@ * */ -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/VideoPipeline/VideoOverlay.h" #include "CommonTools/Async/InferenceRoutines.h" #include "NintendoSwitch/Commands/NintendoSwitch_Commands_PushButtons.h" @@ -117,7 +117,7 @@ void checkpoint_08( {arrow} ); if (ret < 0){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Failed to feed mom's sandwich.", env.console diff --git a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_10.cpp b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_10.cpp index 4fe204abbf..ce3b7e909a 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_10.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_10.cpp @@ -5,7 +5,7 @@ */ #include "CommonFramework/VideoPipeline/VideoOverlay.h" -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonTools/Async/InferenceRoutines.h" #include "CommonTools/VisualDetectors/BlackScreenDetector.h" #include "NintendoSwitch/Commands/NintendoSwitch_Commands_PushButtons.h" @@ -129,7 +129,7 @@ void checkpoint_21( { black_screen } ); if (ret < 0){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "checkpoint_21(): Failed to jump the East Mesagoza wall.", env.console diff --git a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_12.cpp b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_12.cpp index 3f85762be9..90c1ec746d 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_12.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_12.cpp @@ -6,7 +6,7 @@ #include "CommonFramework/VideoPipeline/VideoFeed.h" -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/VideoPipeline/VideoOverlay.h" #include "CommonTools/Async/InferenceRoutines.h" #include "NintendoSwitch/Commands/NintendoSwitch_Commands_PushButtons.h" @@ -120,7 +120,7 @@ void checkpoint_28( {no_minimap} ); if (ret < 0){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Failed to enter Cortondo Gym.", env.console diff --git a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_13.cpp b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_13.cpp index ddd02e7266..8aae6bdb7c 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_13.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_13.cpp @@ -4,7 +4,7 @@ * */ -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/VideoPipeline/VideoOverlay.h" #include "NintendoSwitch/Commands/NintendoSwitch_Commands_PushButtons.h" #include "PokemonSV/Programs/PokemonSV_GameEntry.h" @@ -265,7 +265,7 @@ void checkpoint_29( WallClock start_to_cross_bridge = current_time(); while (true){ if (current_time() - start_to_cross_bridge > std::chrono::minutes(6)){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "checkpoint_26(): Failed to cross bridge after 6 minutes.", env.console diff --git a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_14.cpp b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_14.cpp index 4e8d66f335..e50924792b 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_14.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_14.cpp @@ -4,7 +4,7 @@ * */ -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/VideoPipeline/VideoOverlay.h" #include "NintendoSwitch/Commands/NintendoSwitch_Commands_PushButtons.h" #include "PokemonSV/Inference/PokemonSV_TutorialDetector.h" @@ -231,8 +231,7 @@ void checkpoint_30( overworld_navigation(env.program_info(), env.console, context, NavigationStopCondition::STOP_BATTLE, NavigationMovementMode::DIRECTIONAL_ONLY, 0, +1, 40, 5, false); - }catch (OperationFailedException& e){ - (void) e; + }catch (OperationFailedException&){ // likely attempted to open/close phone to realign, but failed // likely already reached cutscene to battle Bombirdeier. diff --git a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_15.cpp b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_15.cpp index d7d83c5712..a86ce660b6 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_15.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_15.cpp @@ -7,7 +7,7 @@ #include "CommonFramework/VideoPipeline/VideoFeed.h" #include "PokemonSV/Inference/Overworld/PokemonSV_NoMinimapDetector.h" -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/VideoPipeline/VideoOverlay.h" #include "CommonTools/Async/InferenceRoutines.h" #include "NintendoSwitch/Commands/NintendoSwitch_Commands_PushButtons.h" @@ -271,7 +271,7 @@ void checkpoint_33( ); context.wait_for(std::chrono::milliseconds(100)); if (ret < 0){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "checkpoint_33(): Failed to kill 30 pokemon with Let's go.", env.console diff --git a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_18.cpp b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_18.cpp index 7991897ef4..c941ad88a6 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_18.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_18.cpp @@ -4,7 +4,7 @@ * */ -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonTools/Async/InferenceRoutines.h" #include "NintendoSwitch/Commands/NintendoSwitch_Commands_PushButtons.h" #include "PokemonSV/Inference/Overworld/PokemonSV_DirectionDetector.h" @@ -200,7 +200,7 @@ void checkpoint_39( {dialog} ); if (ret < 0){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "checkpoint_39(): Failed to run into Great Tusk/Iron Treads.", env.console diff --git a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_20.cpp b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_20.cpp index 3c9287bc94..c6eed32f38 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_20.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_20.cpp @@ -6,7 +6,7 @@ #include "CommonFramework/VideoPipeline/VideoFeed.h" -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/VideoPipeline/VideoOverlay.h" #include "CommonTools/Async/InferenceRoutines.h" #include "NintendoSwitch/Commands/NintendoSwitch_Commands_PushButtons.h" @@ -482,7 +482,7 @@ void checkpoint_44( {no_minimap} ); if (ret < 0){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Failed to finish reach the Sunflora NPC.", env.console diff --git a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_21.cpp b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_21.cpp index ba06d7dd10..26de51b206 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_21.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_21.cpp @@ -8,7 +8,7 @@ #include "CommonFramework/VideoPipeline/VideoFeed.h" #include "PokemonSV/Inference/Overworld/PokemonSV_NoMinimapDetector.h" -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "NintendoSwitch/Commands/NintendoSwitch_Commands_PushButtons.h" #include "PokemonSV/Inference/Overworld/PokemonSV_DirectionDetector.h" #include "PokemonSV/Programs/PokemonSV_MenuNavigation.h" @@ -276,7 +276,7 @@ void checkpoint_48( ); context.wait_for(std::chrono::milliseconds(100)); if (ret < 0){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "checkpoint_48(): Failed to kill 30 pokemon with Let's go.", env.console diff --git a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_22.cpp b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_22.cpp index dc9e9cbc9d..628fa333bd 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_22.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_22.cpp @@ -9,7 +9,7 @@ #include "CommonTools/Async/InferenceRoutines.h" #include "CommonFramework/VideoPipeline/VideoFeed.h" -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "NintendoSwitch/Commands/NintendoSwitch_Commands_PushButtons.h" #include "PokemonSV/Inference/Overworld/PokemonSV_DirectionDetector.h" #include "PokemonSV/Programs/PokemonSV_MenuNavigation.h" @@ -251,7 +251,7 @@ void checkpoint_52( {white_triangle} ); if (ret < 0){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Failed to detect white triangle in top right, which is an indicator of the Levincia Hide-and-Seek gym challenge.", env.console @@ -274,7 +274,7 @@ void checkpoint_52( {battle} ); if (ret < 0){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Failed to detect white triangle in top right, which is an indicator of the Levincia Hide-and-Seek gym challenge.", env.console @@ -292,7 +292,7 @@ void checkpoint_52( {white_triangle} ); if (ret < 0){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Failed to detect white triangle in top right, which is an indicator of the Levincia Hide-and-Seek gym challenge.", env.console @@ -317,7 +317,7 @@ void checkpoint_52( {battle} ); if (ret < 0){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Failed to detect white triangle in top right, which is an indicator of the Levincia Hide-and-Seek gym challenge.", env.console @@ -335,7 +335,7 @@ void checkpoint_52( {white_triangle} ); if (ret < 0){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Failed to detect white triangle in top right, which is an indicator of the Levincia Hide-and-Seek gym challenge.", env.console diff --git a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_25.cpp b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_25.cpp index f7a30a8851..29ee6f2ef3 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_25.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_25.cpp @@ -9,7 +9,7 @@ #include "CommonFramework/VideoPipeline/VideoFeed.h" #include "PokemonSV/Inference/Overworld/PokemonSV_NoMinimapDetector.h" -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonTools/Async/InferenceRoutines.h" #include "NintendoSwitch/Commands/NintendoSwitch_Commands_PushButtons.h" #include "PokemonSV/Programs/PokemonSV_GameEntry.h" @@ -303,7 +303,7 @@ void checkpoint_59( ); context.wait_for(std::chrono::milliseconds(100)); if (ret < 0){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Team Star Poison: Failed to kill 30 pokemon with Let's go.", env.console diff --git a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_26.cpp b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_26.cpp index be9ef0e559..d3139615fa 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_26.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_26.cpp @@ -8,7 +8,7 @@ #include "CommonFramework/VideoPipeline/VideoFeed.h" #include "CommonTools/VisualDetectors/BlackScreenDetector.h" -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonTools/Async/InferenceRoutines.h" #include "NintendoSwitch/Commands/NintendoSwitch_Commands_PushButtons.h" #include "PokemonSV/Programs/PokemonSV_GameEntry.h" @@ -212,7 +212,7 @@ void checkpoint_62( env.console.log("Detected black screen. Assume entered Eatery."); } if (ret < 0){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Never detected black screen. Failed to enter Eatery.", env.console diff --git a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_28.cpp b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_28.cpp index 4d0a35d36b..a2fda9344c 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_28.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_28.cpp @@ -8,7 +8,7 @@ #include "CommonFramework/VideoPipeline/VideoFeed.h" #include "PokemonSV/Inference/Overworld/PokemonSV_NoMinimapDetector.h" -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonTools/Async/InferenceRoutines.h" #include "NintendoSwitch/Commands/NintendoSwitch_Commands_PushButtons.h" #include "PokemonSV/Programs/PokemonSV_GameEntry.h" @@ -288,7 +288,7 @@ void checkpoint_69(SingleSwitchProgramEnvironment& env, ProControllerContext& co ); context.wait_for(std::chrono::milliseconds(100)); if (ret < 0){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Team Star Fairy: Failed to kill 30 pokemon with Let's go.", env.console diff --git a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_30.cpp b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_30.cpp index b185fe5919..bd6e2eb545 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_30.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_30.cpp @@ -8,7 +8,7 @@ #include "PokemonSV/Inference/Overworld/PokemonSV_NoMinimapDetector.h" #include "CommonFramework/VideoPipeline/VideoFeed.h" -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonTools/Async/InferenceRoutines.h" #include "NintendoSwitch/Commands/NintendoSwitch_Commands_PushButtons.h" #include "PokemonSV/Programs/PokemonSV_GameEntry.h" @@ -221,7 +221,7 @@ void checkpoint_76(SingleSwitchProgramEnvironment& env, ProControllerContext& co {no_minimap} ); if (ret < 0){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "checkpoint_76(): Failed to Snow Slope Run.", env.console diff --git a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_31.cpp b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_31.cpp index a64ee902ff..f75050b899 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_31.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_31.cpp @@ -9,7 +9,7 @@ #include "CommonFramework/VideoPipeline/VideoFeed.h" #include "PokemonSV/Inference/Overworld/PokemonSV_NoMinimapDetector.h" -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonTools/Async/InferenceRoutines.h" #include "NintendoSwitch/Commands/NintendoSwitch_Commands_PushButtons.h" #include "PokemonSV/Programs/PokemonSV_GameEntry.h" @@ -572,7 +572,7 @@ void beat_team_star_fighting2(SingleSwitchProgramEnvironment& env, ProController ); context.wait_for(std::chrono::milliseconds(100)); if (ret < 0){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "checkpoint_48(): Failed to kill 30 pokemon with Let's go.", env.console diff --git a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_33.cpp b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_33.cpp index f7d8089aa2..55e6b54d97 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_33.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_33.cpp @@ -12,7 +12,7 @@ #include "PokemonSV/Programs/Battles/PokemonSV_SinglesBattler.h" #include "PokemonSV/Programs/Battles/PokemonSV_Battles.h" -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonTools/Async/InferenceRoutines.h" #include "NintendoSwitch/Commands/NintendoSwitch_Commands_PushButtons.h" #include "PokemonSV/Programs/PokemonSV_GameEntry.h" @@ -160,7 +160,7 @@ void checkpoint_86(SingleSwitchProgramEnvironment& env, ProControllerContext& co { black_screen } ); if (ret < 0){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Never detected black screen. Failed to glide from the Academy to the route leading to the Pokemon League.", env.console @@ -368,7 +368,7 @@ void checkpoint_88(SingleSwitchProgramEnvironment& env, ProControllerContext& co // We don't setup Misty Terrain on the Whiscash since Muddy Water can lower our accuracy. bool is_won = run_pokemon(env.console, context, move_table1, true, terastallized); if (!is_won){// throw exception if we lose - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Failed to beat the Ground trainer. Reset.", env.console @@ -389,7 +389,7 @@ void checkpoint_88(SingleSwitchProgramEnvironment& env, ProControllerContext& co std::vector move_table2 = {move2}; is_won = run_pokemon(env.console, context, move_table2, true, terastallized); if (!is_won){// throw exception if we lose - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Failed to beat the Steel trainer. Reset.", env.console @@ -479,7 +479,7 @@ GameTitle get_game_title(SingleSwitchProgramEnvironment& env, ProControllerConte } if (game_title == GameTitle::UNKNOWN){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "get_game_title(): Unable to determine what game we are playing. " "The color of the bottom bar in the Pokemon Summary page doesn't match any of the expected colors.", @@ -510,7 +510,7 @@ std::string get_ride_pokemon_name(SingleSwitchProgramEnvironment& env, ProContro } if (results.empty()){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "AutoStory_Segment_34::checkpoint_86(): Unable to read selected item. No valid results.\n" + language_warning(language), env.console @@ -518,7 +518,7 @@ std::string get_ride_pokemon_name(SingleSwitchProgramEnvironment& env, ProContro } if (results.size() > 1){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "AutoStory_Segment_34::checkpoint_86(): Unable to read selected item. Ambiguous or multiple results.\n" + language_warning(language), env.console diff --git a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_34.cpp b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_34.cpp index 6ea91545cc..5d41c3e898 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_34.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_34.cpp @@ -5,7 +5,7 @@ */ #include "PokemonSV/Programs/Battles/PokemonSV_SinglesBattler.h" -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonTools/Async/InferenceRoutines.h" #include "NintendoSwitch/Commands/NintendoSwitch_Commands_PushButtons.h" #include "PokemonSV/Programs/PokemonSV_GameEntry.h" @@ -141,7 +141,7 @@ void checkpoint_91(SingleSwitchProgramEnvironment& env, ProControllerContext& co bool terastallized = false; bool is_won = run_pokemon(env.console, context, move_table1, true, terastallized); if (!is_won){// throw exception if we lose - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Failed to beat the Penny. Reset.", env.console diff --git a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_40.cpp b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_40.cpp index cefaee7444..bb08a5b5f5 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_40.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_40.cpp @@ -7,7 +7,7 @@ #include "PokemonSV/Programs/Battles/PokemonSV_SinglesBattler.h" #include "PokemonSV/Inference/PokemonSV_TutorialDetector.h" -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonTools/Async/InferenceRoutines.h" #include "NintendoSwitch/Commands/NintendoSwitch_Commands_PushButtons.h" #include "PokemonSV/Programs/PokemonSV_GameEntry.h" @@ -112,7 +112,7 @@ void checkpoint_104(SingleSwitchProgramEnvironment& env, ProControllerContext& c // start with Psychic to defeat Iron Moth for Violet, which quad resists Moonblast. bool is_won = run_pokemon(env.console, context, move_table1, true, terastallized); if (!is_won){// throw exception if we lose - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Failed to beat the AI Professor. Reset.", env.console @@ -140,7 +140,7 @@ void checkpoint_104(SingleSwitchProgramEnvironment& env, ProControllerContext& c std::vector move_table2 = {move4, move4, move4, move4, move4, move4_tera}; is_won = run_pokemon(env.console, context, move_table2, true, terastallized); if (!is_won){// throw exception if we lose - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Failed to beat the AI Professor, round 2. This shouldn't be possible. Reset.", env.console @@ -162,7 +162,7 @@ void checkpoint_104(SingleSwitchProgramEnvironment& env, ProControllerContext& c {tutorial} ); if (ret < 0){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Stuck trying to clear the Koraidon/Miraidon form change tutorial.", env.console diff --git a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_MenuOption.cpp b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_MenuOption.cpp index 3dbb0d9922..06c336e8e1 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_MenuOption.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_MenuOption.cpp @@ -6,7 +6,7 @@ #include #include "NintendoSwitch/Commands/NintendoSwitch_Commands_PushButtons.h" -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/VideoPipeline/VideoFeed.h" #include "CommonTools/OCR/OCR_NumberReader.h" #include "PokemonSV_MenuOption.h" @@ -64,7 +64,7 @@ void MenuOption::set_target_option(const std::vector& targ pbf_press_dpad(m_context, DPAD_RIGHT, 80ms, 400ms); } - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "MenuOption::set_target_option(): Unable to set option to the correct toggle.", m_stream @@ -76,7 +76,7 @@ int8_t MenuOption::get_selected_index(const ImageViewRGB32& screen) const { m_context.wait_for_all_requests(); ImageFloatBox box; if (!m_arrow.detect(box, screen)){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "MenuOption::get_selected_index(): Unable to find cursor.\n" "We expect to be in the Options screen. Ensure you selected the correct Autostory start segment.", @@ -89,7 +89,7 @@ int8_t MenuOption::get_selected_index(const ImageViewRGB32& screen) const { int8_t selected_index = (int8_t)(slot + 0.5); if (selected_index < 0 || selected_index >= 10){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "MenuOption::get_selected_index(): Invalid cursor slot.", m_stream @@ -128,7 +128,7 @@ std::string MenuOption::read_option(const ImageViewRGB32& cropped) const{ return "fast"; } } - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "MenuOption::read_option(): Unable to read item. No results returned.", m_stream @@ -136,7 +136,7 @@ std::string MenuOption::read_option(const ImageViewRGB32& cropped) const{ } if (results.size() > 1){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "MenuOption::read_option(): Unable to read item. Ambiguous or multiple results.\n" + language_warning(m_language), m_stream diff --git a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_OliveActionFailedException.h b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_OliveActionFailedException.h index 5ab0d6f4ce..cccdc0cc6e 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_OliveActionFailedException.h +++ b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_OliveActionFailedException.h @@ -7,7 +7,7 @@ #ifndef PokemonAutomation_OliveActionFailedException_H #define PokemonAutomation_OliveActionFailedException_H -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" namespace PokemonAutomation{ namespace NintendoSwitch{ @@ -26,7 +26,7 @@ enum class OliveFail{ // Thrown by subroutines if they fail for an in-game reason. // These include recoverable errors which can be consumed by the program. -class OliveActionFailedException : public OperationFailedException{ +class OliveActionFailedException : public OperationFailedExceptionWithScreenshot{ public: OliveActionFailedException( ErrorReport error_report, @@ -34,7 +34,7 @@ class OliveActionFailedException : public OperationFailedException{ VideoStream& stream, OliveFail fail_reason = OliveFail::NONE ) - : OperationFailedException(error_report, std::move(message), stream) + : OperationFailedExceptionWithScreenshot(error_report, std::move(message), stream) , m_fail_reason(fail_reason) {} virtual const char* name() const override{ return "OliveActionFailedException"; } diff --git a/SerialPrograms/Source/PokemonSV/Programs/Battles/PokemonSV_BasicCatcher.cpp b/SerialPrograms/Source/PokemonSV/Programs/Battles/PokemonSV_BasicCatcher.cpp index f83153e29e..4a94272a16 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/Battles/PokemonSV_BasicCatcher.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/Battles/PokemonSV_BasicCatcher.cpp @@ -4,7 +4,7 @@ * */ -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/VideoPipeline/VideoFeed.h" #include "CommonTools/Async/InferenceRoutines.h" #include "NintendoSwitch/Commands/NintendoSwitch_Commands_PushButtons.h" @@ -140,7 +140,7 @@ int16_t throw_ball( return 0; } if (attempts >= 3){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Unable to find desired ball after multiple attempts. Did you run out?", stream @@ -278,7 +278,7 @@ CatchResults basic_catcher( pbf_press_button(context, BUTTON_B, 160ms, 1840ms); break; default: - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "basic_catcher(): No state detected after 2 minutes.", stream diff --git a/SerialPrograms/Source/PokemonSV/Programs/Battles/PokemonSV_Battles.cpp b/SerialPrograms/Source/PokemonSV/Programs/Battles/PokemonSV_Battles.cpp index 951e336e72..026eaf5156 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/Battles/PokemonSV_Battles.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/Battles/PokemonSV_Battles.cpp @@ -6,7 +6,7 @@ #include #include "CommonFramework/Exceptions/ProgramFinishedException.h" -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/Exceptions/FatalProgramException.h" #include "CommonFramework/Tools/ProgramEnvironment.h" #include "CommonTools/Async/InferenceRoutines.h" @@ -39,7 +39,7 @@ void auto_heal_from_menu_or_overworld( bool healed = false; while (true){ if (current_time() - start > std::chrono::minutes(5)){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "auto_heal_from_menu(): Failed auto-heal after 5 minutes.", stream @@ -81,7 +81,7 @@ void auto_heal_from_menu_or_overworld( pbf_press_button(context, BUTTON_B, 160ms, 840ms); continue; default: - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "auto_heal_from_menu(): No state detected after 60 seconds.", stream @@ -127,13 +127,13 @@ int run_from_battle( continue; case 2: stream.log("Detected own " + STRING_POKEMON + " fainted..."); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Your " + STRING_POKEMON + " fainted while attempting to run away.", stream ); default: - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "run_from_battle(): No state detected after 60 seconds.", stream @@ -141,7 +141,7 @@ int run_from_battle( } } - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Failed to run away after 10 attempts.", stream @@ -193,13 +193,13 @@ int run_from_battle( case 2: stream.log("Detected own " + STRING_POKEMON + " fainted..."); tracker.report_in_battle(); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Your " + STRING_POKEMON + " fainted while attempting to run away.", stream ); default: - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "run_from_battle(): No state detected after 60 seconds.", stream @@ -207,7 +207,7 @@ int run_from_battle( } } - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Failed to run away after 10 attempts.", stream @@ -305,8 +305,8 @@ void process_battle( case EncounterActionsAction::RUN_AWAY: try{ run_from_battle(stream, context, tracker); - }catch (OperationFailedException& e){ - throw FatalProgramException(std::move(e)); + }catch (OperationFailedExceptionWithScreenshot& e){ + throw FatalProgramException(e.error_report_mode(), e.message(), e.video_stream(), e.screenshot()); } caught = false; should_save = false; diff --git a/SerialPrograms/Source/PokemonSV/Programs/Battles/PokemonSV_SinglesBattler.cpp b/SerialPrograms/Source/PokemonSV/Programs/Battles/PokemonSV_SinglesBattler.cpp index 8b43c5c2d6..8fadef75b1 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/Battles/PokemonSV_SinglesBattler.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/Battles/PokemonSV_SinglesBattler.cpp @@ -4,7 +4,7 @@ * */ -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonTools/Async/InferenceRoutines.h" #include "NintendoSwitch/Commands/NintendoSwitch_Commands_PushButtons.h" #include "Pokemon/Pokemon_Strings.h" @@ -114,7 +114,7 @@ bool run_battle_menu( return false; } } - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Invalid SinglesMoveType: " + std::to_string((int)move.type), stream @@ -234,7 +234,7 @@ bool run_pokemon( default: consecutive_timeouts++; if (consecutive_timeouts == 3){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "No state detected after 6 minutes.", stream @@ -311,7 +311,7 @@ bool run_singles_battle( pbf_wait(context, 400ms); continue; default: - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Unable to send in a " + STRING_POKEMON + ".", stream diff --git a/SerialPrograms/Source/PokemonSV/Programs/Boxes/PokemonSV_BoxRoutines.cpp b/SerialPrograms/Source/PokemonSV/Programs/Boxes/PokemonSV_BoxRoutines.cpp index 00ce2b14cb..f69e6a8952 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/Boxes/PokemonSV_BoxRoutines.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/Boxes/PokemonSV_BoxRoutines.cpp @@ -7,7 +7,9 @@ //#include //#include //#include -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/ErrorReports/ErrorReports.h" +#include "CommonFramework/Notifications/ProgramNotifications.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/ImageTools/ImageStats.h" #include "CommonFramework/VideoPipeline/VideoFeed.h" #include "CommonFramework/VideoPipeline/VideoOverlay.h" @@ -40,7 +42,7 @@ bool change_view_to_stats_or_judge( for (size_t attempts = 0;; attempts++){ if (throw_exception){ if (attempts == 10){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Unable to change Pokemon view after 10 tries.", stream @@ -91,7 +93,7 @@ void change_view_to_judge( OverlayBoxScope name_bar_overlay(stream.overlay(), name_bar); for (size_t attempts = 0;; attempts++){ if (attempts == 10){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Unable to change Pokemon view to judge after 10 tries. Have you unlocked it?", stream @@ -287,8 +289,18 @@ void load_one_column_to_party( try{ // Move the held column to party move_box_cursor(env.program_info(), stream, context, BoxCursorLocation::PARTY, has_clone_ride_pokemon ? 2 : 1, 0); - }catch (OperationFailedException& e){ - e.send_notification(env, notification); + }catch (OperationFailedExceptionWithScreenshot& e){ + send_program_recoverable_error_notification(env, notification, e.message(), *e.screenshot()); + if (e.error_report_mode() == ErrorReport::SEND_ERROR_REPORT){ + PokemonAutomation::report_error( + &env.logger(), + env.program_info(), + "Recoverable: OperationFailedExceptionWithScreenshot", + {{"Message:", e.message()}}, + *e.screenshot(), + &e.video_stream()->history() + ); + } if (++fail_count == 10){ dump_image_and_throw_recoverable_exception( @@ -331,8 +343,18 @@ void unload_one_column_from_party( try{ // Move the held column to target move_box_cursor(env.program_info(), stream, context, BoxCursorLocation::SLOTS, has_clone_ride_pokemon ? 1 : 0, column_index); - }catch (OperationFailedException& e){ - e.send_notification(env, notification); + }catch (OperationFailedExceptionWithScreenshot& e){ + send_program_recoverable_error_notification(env, notification, e.message(), *e.screenshot()); + if (e.error_report_mode() == ErrorReport::SEND_ERROR_REPORT){ + PokemonAutomation::report_error( + &env.logger(), + env.program_info(), + "Recoverable: OperationFailedExceptionWithScreenshot", + {{"Message:", e.message()}}, + *e.screenshot(), + &e.video_stream()->history() + ); + } if (++fail_count == 10){ dump_image_and_throw_recoverable_exception( diff --git a/SerialPrograms/Source/PokemonSV/Programs/Eggs/PokemonSV_EggAutonomous.cpp b/SerialPrograms/Source/PokemonSV/Programs/Eggs/PokemonSV_EggAutonomous.cpp index 9df38b0128..5e95ffde6a 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/Eggs/PokemonSV_EggAutonomous.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/Eggs/PokemonSV_EggAutonomous.cpp @@ -9,7 +9,7 @@ #include "CommonFramework/ErrorReports/ErrorReports.h" #include "CommonFramework/Exceptions/ProgramFinishedException.h" #include "CommonFramework/Exceptions/FatalProgramException.h" -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" //#include "CommonFramework/Exceptions/UnexpectedBattleException.h" #include "Common/Cpp/ColoredText.h" #include "CommonFramework/Notifications/ProgramNotifications.h" @@ -775,10 +775,10 @@ void EggAutonomous::save_game(SingleSwitchProgramEnvironment& env, ProController }else{ save_game_from_menu(env.program_info(), env.console, context); } - }catch (OperationFailedException& e){ + }catch (OperationFailedExceptionWithScreenshot& e){ // To be safe: avoid interrupting or corrupting game saving, // make game saving non error recoverable - throw FatalProgramException(std::move(e)); + throw FatalProgramException(e.error_report_mode(), e.message(), e.video_stream(), e.screenshot()); } } @@ -835,7 +835,7 @@ bool EggAutonomous::handle_recoverable_error( std::string fail_message = e.message(); consecutive_failures++; if (consecutive_failures >= 3){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Failed 3 times in the row.\n" + fail_message, env.console diff --git a/SerialPrograms/Source/PokemonSV/Programs/Eggs/PokemonSV_EggRoutines.cpp b/SerialPrograms/Source/PokemonSV/Programs/Eggs/PokemonSV_EggRoutines.cpp index e9667d0b2f..52b40e8fc1 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/Eggs/PokemonSV_EggRoutines.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/Eggs/PokemonSV_EggRoutines.cpp @@ -5,7 +5,7 @@ */ #include "Common/Cpp/Exceptions.h" -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/Notifications/ProgramNotifications.h" #include "CommonFramework/VideoPipeline/VideoFeed.h" #include "CommonFramework/VideoPipeline/VideoOverlay.h" @@ -167,7 +167,7 @@ bool do_egg_cycle_motion( run_singles_battle(stream, context, *battle_ai, false); return true; } - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::NO_ERROR_REPORT, "Detected battle menu. You got attacked!", stream diff --git a/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_AuctionFarmer.cpp b/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_AuctionFarmer.cpp index d326bb3bf3..21fdad8548 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_AuctionFarmer.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_AuctionFarmer.cpp @@ -8,7 +8,8 @@ #include #include "CommonFramework/StaticGlobals.h" #include "CommonFramework/Exceptions/FatalProgramException.h" -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/ErrorReports/ErrorReports.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/ImageTypes/BinaryImage.h" #include "CommonFramework/Notifications/ProgramNotifications.h" #include "CommonFramework/ProgramStats/StatsTracking.h" @@ -192,11 +193,11 @@ void AuctionFarmer::reset_auctions(SingleSwitchProgramEnvironment& env, ProContr go_home(env.console, context); context.wait_for_all_requests(); reset_game_from_home(env.program_info(), env.console, context, 1000ms); - }catch (OperationFailedException& e){ + }catch (OperationFailedExceptionWithScreenshot& e){ AuctionFarmer_Descriptor::Stats& stats = env.current_stats(); stats.m_errors++; env.update_stats(); - throw FatalProgramException(std::move(e)); + throw FatalProgramException(e.error_report_mode(), e.message(), e.video_stream(), e.screenshot()); } } @@ -310,7 +311,7 @@ void AuctionFarmer::move_to_auctioneer(SingleSwitchProgramEnvironment& env, ProC } tries++; } - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Too many attempts to talk to the NPC.", env.console @@ -354,7 +355,7 @@ void AuctionFarmer::move_dialog_to_center(SingleSwitchProgramEnvironment& env, P } if (!offer_visible){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Lost offer dialog for wanted item.", env.console @@ -568,9 +569,19 @@ void AuctionFarmer::program(SingleSwitchProgramEnvironment& env, ProControllerCo if (is_good_offer(offer)){ try{ move_to_auctioneer(env, context, offer); - }catch (OperationFailedException& e){ + }catch (OperationFailedExceptionWithScreenshot& e){ stats.m_errors++; - e.send_notification(env, NOTIFICATION_ERROR_RECOVERABLE); + send_program_recoverable_error_notification(env, NOTIFICATION_ERROR_RECOVERABLE, e.message(), *e.screenshot()); + if (e.error_report_mode() == ErrorReport::SEND_ERROR_REPORT){ + PokemonAutomation::report_error( + &env.logger(), + env.program_info(), + "Recoverable: OperationFailedExceptionWithScreenshot", + {{"Message:", e.message()}}, + *e.screenshot(), + &e.video_stream()->history() + ); + } npc_tries++; // if ONE_NPC the program already tries multiple times without change to compensate for dropped inputs @@ -581,7 +592,7 @@ void AuctionFarmer::program(SingleSwitchProgramEnvironment& env, ProControllerCo VideoSnapshot screen = env.console.video().snapshot(); send_program_recoverable_error_notification(env, NOTIFICATION_ERROR_RECOVERABLE, e.message(), screen); }else{ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Failed to talk to the NPC!", env.console diff --git a/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_BlueberryCatchPhoto.cpp b/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_BlueberryCatchPhoto.cpp index e3b200d0d1..117a4c095a 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_BlueberryCatchPhoto.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_BlueberryCatchPhoto.cpp @@ -4,7 +4,7 @@ * */ -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/Tools/ErrorDumper.h" #include "CommonFramework/Exceptions/ProgramFinishedException.h" #include "CommonTools/Async/InferenceRoutines.h" @@ -272,7 +272,7 @@ CameraAngle quest_photo_navi( break; default: - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Invalid photo quest.", console @@ -367,7 +367,7 @@ void quest_photo( return_to_plaza(info, console, context); }catch (...){ console.log("Unable to flee."); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Unable to flee!", console @@ -639,7 +639,7 @@ void quest_catch_navi( break; default: - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Invalid catch quest.", console @@ -671,7 +671,7 @@ void quest_catch_throw_ball( while (ball_reader == ""){ if (current_time() - start > std::chrono::minutes(2)){ console.log("Timed out trying to read ball after 2 minutes.", COLOR_RED); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Timed out trying to read ball after 2 minutes.", console @@ -694,7 +694,7 @@ void quest_catch_throw_ball( int quantity = move_to_ball(reader, console, context, selected_ball); if (quantity == 0){ console.log("Unable to find ball."); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Unable to find ball.", console @@ -742,7 +742,7 @@ void quest_catch_handle_battle( ); if (bMenu < 0){ console.log("Unable to find menu_before_throw."); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Unable to find menu_before_throw.", console @@ -825,7 +825,7 @@ void quest_catch_handle_battle( ); if (ret3 == 0){ console.log("Battle menu detected early. Out of PP/No move in slot, please check your setup."); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Battle menu detected early. Out of PP, please check your setup.", console @@ -863,7 +863,7 @@ void quest_catch_handle_battle( break; default: console.log("Invalid state ret2_run. Out of moves?"); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Invalid state ret2_run. Out of moves?", console @@ -889,7 +889,7 @@ void quest_catch_handle_battle( break; default: console.log("Invalid state in run_battle()."); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Invalid state in run_battle().", console @@ -992,7 +992,7 @@ void wild_battle_tera( while(true){ if (current_time() - start > std::chrono::minutes(5)){ console.log("Timed out during battle after 5 minutes.", COLOR_RED); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Timed out during battle after 5 minutes.", console @@ -1041,7 +1041,7 @@ void wild_battle_tera( } break; default: - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Timed out during battle. Stuck, crashed, or took more than 90 seconds for a turn.", console diff --git a/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_BlueberryQuests.cpp b/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_BlueberryQuests.cpp index dd1abfa974..e1948877db 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_BlueberryQuests.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_BlueberryQuests.cpp @@ -4,7 +4,7 @@ * */ -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/Tools/ErrorDumper.h" #include "CommonFramework/ImageTypes/ImageViewRGB32.h" #include "CommonFramework/Exceptions/ProgramFinishedException.h" @@ -282,7 +282,7 @@ std::vector process_quest_list( default: //This case is handled in BBQSoloFarmer. stream.log("OOEggs is Stop in process_quest_list()."); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "OOEggs is Stop in process_quest_list().", stream @@ -392,7 +392,7 @@ std::vector process_quest_list( } /* if (!rerolled && quests_to_do.size() == 0){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "No possible quests! Check language selection.", stream @@ -503,7 +503,7 @@ bool process_and_do_quest( quest_catch(env.program_info(), console, context, BBQ_OPTIONS, current_quest); break; default: - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Unknown quest selection.", console @@ -819,7 +819,7 @@ void quest_sneak_up( break; default: console.log("Invalid state quest_sneak_up(). Smoke Ball equipped?"); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Invalid state quest_sneak_up(). Smoke Ball equipped?", console @@ -836,7 +836,7 @@ void quest_sneak_up( break; default: console.log("Invalid state in run_battle()."); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Invalid state in run_battle().", console @@ -1192,7 +1192,7 @@ void quest_sandwich( condiments = {{"chili-sauce", (uint8_t)1}}; break; default: - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Invalid sandwich selection.", stream @@ -1267,7 +1267,7 @@ void quest_tera_raid( return_to_plaza(env.program_info(), console, context); }catch (...){ console.log("Unable to flee."); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Unable to flee!", console diff --git a/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_ClaimMysteryGift.cpp b/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_ClaimMysteryGift.cpp index f296494aac..cf85188711 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_ClaimMysteryGift.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_ClaimMysteryGift.cpp @@ -6,7 +6,7 @@ #include "CommonTools/Async/InferenceRoutines.h" #include "CommonTools/VisualDetectors/BlackScreenDetector.h" -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" //#include "CommonFramework/GlobalSettingsPanel.h" #include "CommonFramework/Notifications/ProgramNotifications.h" //#include "CommonFramework/VideoPipeline/VideoFeed.h" @@ -193,7 +193,7 @@ void ClaimMysteryGift::enter_mystery_gift_via_internet_window(SingleSwitchProgra return; } - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "enter_mystery_gift_code_window(): Failed to reach Mystery Gift code window after several attempts.", env.console @@ -215,7 +215,7 @@ void ClaimMysteryGift::claim_internet_mystery_gift(SingleSwitchProgramEnvironmen if (ret == 0){ env.console.log("Gradient arrow detected."); }else{ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Failed to detect gradient arrow. We might not be in the Mystery Gift via Internet screen.", env.console @@ -281,7 +281,7 @@ void ClaimMysteryGift::claim_internet_mystery_gift(SingleSwitchProgramEnvironmen {arrow} ); if (ret < 0){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Failed to detect gradient arrow. We might not be in the Mystery Gift via Internet screen.", env.console @@ -361,7 +361,7 @@ void ClaimMysteryGift::enter_mystery_gift_code_window(SingleSwitchProgramEnviron return; } - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "enter_mystery_gift_code_window(): Failed to reach Mystery Gift code window after several attempts.", env.console diff --git a/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_FlyingTrialFarmer.cpp b/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_FlyingTrialFarmer.cpp index d5be8e739c..857b4f1f4d 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_FlyingTrialFarmer.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_FlyingTrialFarmer.cpp @@ -5,7 +5,7 @@ */ #include "CommonFramework/StaticGlobals.h" -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/Notifications/ProgramNotifications.h" #include "CommonFramework/ProgramStats/StatsTracking.h" #include "CommonTools/Async/InferenceRoutines.h" @@ -122,7 +122,7 @@ bool FlyingTrialFarmer::run_rewards(SingleSwitchProgramEnvironment& env, ProCont {dialog} ); if (ret != 0){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "End of trial not detected after 3 minutes.", env.console @@ -160,7 +160,7 @@ bool FlyingTrialFarmer::run_rewards(SingleSwitchProgramEnvironment& env, ProCont trial_passed = true; continue; default: - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "No recognized state after 80 seconds.", env.console diff --git a/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_GimmighoulChestFarmer.cpp b/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_GimmighoulChestFarmer.cpp index 2ad50d9092..0606394ecb 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_GimmighoulChestFarmer.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_GimmighoulChestFarmer.cpp @@ -5,7 +5,7 @@ */ #include "Common/Cpp/PrettyPrint.h" -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/Notifications/ProgramNotifications.h" #include "CommonFramework/ProgramStats/StatsTracking.h" #include "CommonTools/Async/InferenceRoutines.h" @@ -203,7 +203,7 @@ void GimmighoulChestFarmer::program(SingleSwitchProgramEnvironment& env, ProCont if (ret2 != 0){ stats.errors++; env.update_stats(); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Failed to return to Overworld after two minutes. Did your attack miss or fail to defeat Gimmighoul in one hit?", env.console @@ -237,7 +237,7 @@ void GimmighoulChestFarmer::program(SingleSwitchProgramEnvironment& env, ProCont if (ret2 != 0){ stats.errors++; env.update_stats(); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Failed to return to Overworld after two minutes.", env.console diff --git a/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_MaterialFarmerTools.cpp b/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_MaterialFarmerTools.cpp index d031d10716..f440923e8a 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_MaterialFarmerTools.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_MaterialFarmerTools.cpp @@ -9,7 +9,8 @@ #include "Common/Cpp/PrettyPrint.h" #include "CommonFramework/StaticGlobals.h" #include "CommonFramework/Exceptions/ProgramFinishedException.h" -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/ErrorReports/ErrorReports.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/Exceptions/UnexpectedBattleException.h" #include "CommonFramework/Exceptions/FatalProgramException.h" #include "CommonFramework/Notifications/ProgramNotifications.h" @@ -292,10 +293,20 @@ void run_material_farmer( context.wait_for_all_requests(); } - }catch (OperationFailedException& e){ + }catch (OperationFailedExceptionWithScreenshot& e){ stats.m_errors++; env.update_stats(); - e.send_notification(env, options.NOTIFICATION_ERROR_RECOVERABLE); + send_program_recoverable_error_notification(env, options.NOTIFICATION_ERROR_RECOVERABLE, e.message(), *e.screenshot()); + if (e.error_report_mode() == ErrorReport::SEND_ERROR_REPORT){ + PokemonAutomation::report_error( + &env.logger(), + env.program_info(), + "Recoverable: OperationFailedExceptionWithScreenshot", + {{"Message:", e.message()}}, + *e.screenshot(), + &e.video_stream()->history() + ); + } // save screenshot after operation failed, // dump_snapshot(console); @@ -689,8 +700,8 @@ void run_from_battles_and_back_to_pokecenter( stream.overlay().add_log("Detected battle. Now running away."); try{ run_from_battle(stream, context); - }catch (OperationFailedException& e){ - throw FatalProgramException(std::move(e)); + }catch (OperationFailedExceptionWithScreenshot& e){ + throw FatalProgramException(e.error_report_mode(), e.message(), e.video_stream(), e.screenshot()); } } } @@ -748,7 +759,7 @@ void fly_from_paldea_to_blueberry_entrance(const ProgramInfo& info, VideoStream& } if (!isFlySuccessful){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Failed to fly to Blueberry academy, five times in a row.", stream @@ -817,7 +828,7 @@ void move_from_blueberry_entrance_to_league_club(const ProgramInfo& info, VideoS } if (!isSuccessful){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Failed to enter League club room, five times in a row.", stream @@ -867,7 +878,7 @@ void move_from_item_printer_to_blueberry_entrance(const ProgramInfo& info, Video stream.log("Blueberry navigation menu detected."); }else{ stream.log("Failed to detect Blueberry navigation menu."); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Failed to find the exit from the League room.", stream @@ -883,7 +894,7 @@ void move_from_item_printer_to_blueberry_entrance(const ProgramInfo& info, Video if (ret == 0){ stream.log("Overworld detected"); }else{ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Failed to detect overworld.", stream @@ -933,7 +944,7 @@ void fly_from_blueberry_to_north_province_3(const ProgramInfo& info, VideoStream if (!isFlySuccessful){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Failed to fly to North province area 3, ten times in a row.", stream diff --git a/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_TournamentFarmer.cpp b/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_TournamentFarmer.cpp index adb2a4cd36..f2d4665858 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_TournamentFarmer.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_TournamentFarmer.cpp @@ -5,7 +5,7 @@ */ #include "CommonFramework/Logging/Logger.h" -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/Notifications/ProgramNotifications.h" #include "CommonFramework/ProgramStats/StatsTracking.h" #include "CommonTools/Images/ImageFilter.h" @@ -288,7 +288,7 @@ void TournamentFarmer::run_battle(SingleSwitchProgramEnvironment& env, ProContro stats.errors++; env.update_stats(); send_program_status_notification(env, NOTIFICATION_STATUS_UPDATE); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Took more than 6 turns to use Memento. Was Zoroark able to faint?", env.console @@ -302,7 +302,7 @@ void TournamentFarmer::run_battle(SingleSwitchProgramEnvironment& env, ProContro stats.errors++; env.update_stats(); send_program_status_notification(env, NOTIFICATION_STATUS_UPDATE); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Timed out after Happy Hour.", env.console @@ -328,7 +328,7 @@ void TournamentFarmer::run_battle(SingleSwitchProgramEnvironment& env, ProContro stats.errors++; env.update_stats(); send_program_status_notification(env, NOTIFICATION_STATUS_UPDATE); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Could not find battle menu.", env.console @@ -362,7 +362,7 @@ void TournamentFarmer::run_battle(SingleSwitchProgramEnvironment& env, ProContro stats.errors++; env.update_stats(); send_program_status_notification(env, NOTIFICATION_STATUS_UPDATE); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Timed out during battle after 5 minutes.", env.console @@ -410,7 +410,7 @@ void TournamentFarmer::run_battle(SingleSwitchProgramEnvironment& env, ProContro env.log("Timed out during battle. Stuck, crashed, or took more than 90 seconds for a turn.", COLOR_RED); stats.errors++; env.update_stats(); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Timed out during battle. Stuck, crashed, or took more than 90 seconds for a turn.", env.console @@ -441,7 +441,7 @@ void TournamentFarmer::run_battle(SingleSwitchProgramEnvironment& env, ProContro stats.errors++; env.update_stats(); send_program_status_notification(env, NOTIFICATION_STATUS_UPDATE); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Timed out during battle. Stuck, crashed, or took over 30 turns.", env.console @@ -626,7 +626,7 @@ void go_to_academy_fly_point(ProgramEnvironment& env, VideoStream& stream, ProCo } if(!isFlySuccessful){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Failed to fly back to academy!", stream @@ -740,7 +740,7 @@ void TournamentFarmer::program(SingleSwitchProgramEnvironment& env, ProControlle stats.errors++; env.update_stats(); send_program_status_notification(env, NOTIFICATION_STATUS_UPDATE); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Failed to detect battle menu or dialog prompt!", env.console diff --git a/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_TournamentFarmer2.cpp b/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_TournamentFarmer2.cpp index e86726d5a6..c592b0540b 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_TournamentFarmer2.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_TournamentFarmer2.cpp @@ -5,7 +5,7 @@ */ #include "CommonFramework/Logging/Logger.h" -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/Notifications/ProgramNotifications.h" #include "CommonFramework/ProgramStats/StatsTracking.h" #include "CommonTools/Async/InferenceRoutines.h" @@ -196,7 +196,7 @@ void TournamentFarmer2::program(SingleSwitchProgramEnvironment& env, ProControll if (ret != 0){ stats.errors++; env.update_stats(); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Failed to detect battle start!", env.console @@ -238,7 +238,7 @@ void TournamentFarmer2::program(SingleSwitchProgramEnvironment& env, ProControll env.log("Failed to detect battle menu or dialog prompt!"); stats.errors++; env.update_stats(); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Failed to detect battle menu or dialog prompt!", env.console @@ -265,7 +265,7 @@ void TournamentFarmer2::program(SingleSwitchProgramEnvironment& env, ProControll {overworld} ); if (ret < 0){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Failed to return to overworld after 2 minutes.", env.console diff --git a/SerialPrograms/Source/PokemonSV/Programs/General/PokemonSV_ClothingBuyer.cpp b/SerialPrograms/Source/PokemonSV/Programs/General/PokemonSV_ClothingBuyer.cpp index 30a9c12a27..d79d5e87bc 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/General/PokemonSV_ClothingBuyer.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/General/PokemonSV_ClothingBuyer.cpp @@ -5,7 +5,7 @@ */ #include "CommonFramework/Notifications/ProgramNotifications.h" -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonTools/Async/InferenceRoutines.h" #include "CommonTools/StartupChecks/VideoResolutionCheck.h" #include "NintendoSwitch/Commands/NintendoSwitch_Commands_PushButtons.h" @@ -179,7 +179,7 @@ void ClothingBuyer::program(SingleSwitchProgramEnvironment& env, ProControllerCo break; default: env.log("Error looking for wear prompt."); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Error looking for wear prompt.", env.console @@ -190,7 +190,7 @@ void ClothingBuyer::program(SingleSwitchProgramEnvironment& env, ProControllerCo } default: env.log("Error looking for purchase prompt."); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Error looking for purchase prompt.", env.console diff --git a/SerialPrograms/Source/PokemonSV/Programs/General/PokemonSV_SizeChecker.cpp b/SerialPrograms/Source/PokemonSV/Programs/General/PokemonSV_SizeChecker.cpp index 26247e664d..b16a327c60 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/General/PokemonSV_SizeChecker.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/General/PokemonSV_SizeChecker.cpp @@ -4,7 +4,7 @@ * */ -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/Notifications/ProgramNotifications.h" #include "CommonFramework/ProgramStats/StatsTracking.h" #include "CommonTools/Async/InferenceRoutines.h" @@ -92,7 +92,7 @@ void SizeChecker::enter_check_mode(SingleSwitchProgramEnvironment& env, ProContr while (true){ if (current_time() - start > std::chrono::minutes(2)){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "enter_check_mode(): Failed to enter box mode after 2 minutes.", env.console @@ -124,7 +124,7 @@ void SizeChecker::enter_check_mode(SingleSwitchProgramEnvironment& env, ProContr return; default: - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "enter_check_mode(): No recognized state after 60 seconds.", env.console @@ -143,7 +143,7 @@ void SizeChecker::exit_check_mode(SingleSwitchProgramEnvironment& env, ProContro while (true){ if (current_time() - start > std::chrono::minutes(2)){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "exit_check_mode(): Failed to exit box mode after 2 minutes.", env.console @@ -182,7 +182,7 @@ void SizeChecker::exit_check_mode(SingleSwitchProgramEnvironment& env, ProContro return; default: - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "exit_check_mode(): No recognized state after 60 seconds.", env.console @@ -256,7 +256,7 @@ void SizeChecker::program(SingleSwitchProgramEnvironment& env, ProControllerCont {dialog} ); if (ret < 0){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Unable to initiate check after 10 A presses.", env.console diff --git a/SerialPrograms/Source/PokemonSV/Programs/General/PokemonSV_StatsReset.cpp b/SerialPrograms/Source/PokemonSV/Programs/General/PokemonSV_StatsReset.cpp index cf38e3e7f4..b3d4f5ed96 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/General/PokemonSV_StatsReset.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/General/PokemonSV_StatsReset.cpp @@ -4,7 +4,7 @@ * */ -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/Notifications/ProgramNotifications.h" #include "CommonFramework/ProgramStats/StatsTracking.h" #include "CommonTools/Options/LanguageOCROption.h" @@ -189,7 +189,7 @@ bool StatsReset::enter_battle(SingleSwitchProgramEnvironment& env, ProController return false; /* - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( env.console, ErrorReport::SEND_ERROR_REPORT, "Failed to enter battle. Are you facing the Pokemon or in a menu?", true @@ -213,7 +213,7 @@ void StatsReset::open_ball_menu(SingleSwitchProgramEnvironment& env, ProControll stats.errors++; env.update_stats(); send_program_status_notification(env, NOTIFICATION_STATUS_UPDATE); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Timed out trying to read ball after 2 minutes.", env.console @@ -265,7 +265,7 @@ bool StatsReset::run_battle(SingleSwitchProgramEnvironment& env, ProControllerCo env.console.log("Unable to find menu_before_throw."); stats.errors++; env.update_stats(); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Unable to find menu_before_throw.", env.console @@ -286,7 +286,7 @@ bool StatsReset::run_battle(SingleSwitchProgramEnvironment& env, ProControllerCo env.console.log("Unable to find Quick Ball on turn 1."); stats.errors++; env.update_stats(); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Unable to find Quick Ball on turn 1.", env.console @@ -371,7 +371,7 @@ bool StatsReset::run_battle(SingleSwitchProgramEnvironment& env, ProControllerCo env.console.log("Battle menu detected early. Out of PP, please check your setup."); stats.errors++; env.update_stats(); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Battle menu detected early. Out of PP, please check your setup.", env.console @@ -454,7 +454,7 @@ bool StatsReset::run_battle(SingleSwitchProgramEnvironment& env, ProControllerCo env.console.log("Invalid state ret2 run_battle."); stats.errors++; env.update_stats(); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Invalid state ret2 run_battle.", env.console @@ -496,7 +496,7 @@ bool StatsReset::run_battle(SingleSwitchProgramEnvironment& env, ProControllerCo env.console.log("Invalid state in run_battle()."); stats.errors++; env.update_stats(); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Invalid state in run_battle().", env.console @@ -554,7 +554,7 @@ bool StatsReset::check_stats(SingleSwitchProgramEnvironment& env, ProControllerC env.console.log("Invalid state."); stats.errors++; env.update_stats(); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Invalid state.", env.console @@ -595,7 +595,7 @@ void StatsReset::program(SingleSwitchProgramEnvironment& env, ProControllerConte // Try to start battle 3 times. if (c > 2){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Failed to enter battle after 3 attempts.", env.console diff --git a/SerialPrograms/Source/PokemonSV/Programs/General/PokemonSV_StatsResetEventBattle.cpp b/SerialPrograms/Source/PokemonSV/Programs/General/PokemonSV_StatsResetEventBattle.cpp index 42df8ace2f..4b4afdeed3 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/General/PokemonSV_StatsResetEventBattle.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/General/PokemonSV_StatsResetEventBattle.cpp @@ -4,7 +4,7 @@ * */ -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/Notifications/ProgramNotifications.h" #include "CommonFramework/ProgramStats/StatsTracking.h" #include "CommonFramework/VideoPipeline/VideoFeed.h" @@ -342,7 +342,7 @@ bool StatsResetEventBattle::run_battle(SingleSwitchProgramEnvironment& env, ProC env.log("Timed out during battle after 5 minutes.", COLOR_RED); stats.errors++; env.update_stats(); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Timed out during battle after 5 minutes.", env.console @@ -376,7 +376,7 @@ bool StatsResetEventBattle::run_battle(SingleSwitchProgramEnvironment& env, ProC env.log("Timed out during battle. Stuck, crashed, or took more than 90 seconds for a turn.", COLOR_RED); stats.errors++; env.update_stats(); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Timed out during battle. Stuck, crashed, or took more than 90 seconds for a turn.", env.console @@ -395,7 +395,7 @@ bool StatsResetEventBattle::run_battle(SingleSwitchProgramEnvironment& env, ProC BattleBallReader reader(env.console, LANGUAGE); int quantity = move_to_ball(reader, env.console, context, BALL_SELECT.slug()); if (quantity == 0){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Unable to find appropriate ball. Did you run out?", env.console @@ -518,7 +518,7 @@ bool StatsResetEventBattle::check_stats_after_win(SingleSwitchProgramEnvironment StatsResetEventBattle_Descriptor::Stats& stats = env.current_stats(); stats.errors++; env.update_stats(); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "StatsResetEventBattle::check_stats_after_win(): No state detected after 1 minute.", env.console diff --git a/SerialPrograms/Source/PokemonSV/Programs/Glitches/PokemonSV_CloneItems-1.0.1.cpp b/SerialPrograms/Source/PokemonSV/Programs/Glitches/PokemonSV_CloneItems-1.0.1.cpp index a2f70bd4aa..889e71c324 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/Glitches/PokemonSV_CloneItems-1.0.1.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/Glitches/PokemonSV_CloneItems-1.0.1.cpp @@ -5,7 +5,8 @@ */ #include "CommonFramework/Exceptions/FatalProgramException.h" -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/ErrorReports/ErrorReports.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/Notifications/ProgramNotifications.h" #include "CommonFramework/ProgramStats/StatsTracking.h" #include "CommonFramework/VideoPipeline/VideoFeed.h" @@ -183,8 +184,18 @@ bool CloneItems101::clone_item(ProgramEnvironment& env, VideoStream& stream, Pro pbf_press_dpad(context, DPAD_UP, 160ms, 80ms); pbf_press_button(context, BUTTON_A, 160ms, 160ms); } - }catch (OperationFailedException& e){ - e.send_notification(env, NOTIFICATION_ERROR_RECOVERABLE); + }catch (OperationFailedExceptionWithScreenshot& e){ + send_program_recoverable_error_notification(env, NOTIFICATION_ERROR_RECOVERABLE, e.message(), *e.screenshot()); + if (e.error_report_mode() == ErrorReport::SEND_ERROR_REPORT){ + PokemonAutomation::report_error( + &env.logger(), + env.program_info(), + "Recoverable: OperationFailedExceptionWithScreenshot", + {{"Message:", e.message()}}, + *e.screenshot(), + &e.video_stream()->history() + ); + } } continue; case 2: @@ -285,8 +296,18 @@ void CloneItems101::program(SingleSwitchProgramEnvironment& env, ProControllerCo cloned++; stats.m_cloned++; continue; - }catch (OperationFailedException& e){ - e.send_notification(env, NOTIFICATION_ERROR_RECOVERABLE); + }catch (OperationFailedExceptionWithScreenshot& e){ + send_program_recoverable_error_notification(env, NOTIFICATION_ERROR_RECOVERABLE, e.message(), *e.screenshot()); + if (e.error_report_mode() == ErrorReport::SEND_ERROR_REPORT){ + PokemonAutomation::report_error( + &env.logger(), + env.program_info(), + "Recoverable: OperationFailedExceptionWithScreenshot", + {{"Message:", e.message()}}, + *e.screenshot(), + &e.video_stream()->history() + ); + } } #endif diff --git a/SerialPrograms/Source/PokemonSV/Programs/Glitches/PokemonSV_RideCloner-1.0.1.cpp b/SerialPrograms/Source/PokemonSV/Programs/Glitches/PokemonSV_RideCloner-1.0.1.cpp index 15ff611dc3..73d5bfbb4b 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/Glitches/PokemonSV_RideCloner-1.0.1.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/Glitches/PokemonSV_RideCloner-1.0.1.cpp @@ -5,7 +5,8 @@ */ #include "CommonFramework/Exceptions/FatalProgramException.h" -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/ErrorReports/ErrorReports.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/Notifications/ProgramNotifications.h" #include "CommonFramework/ProgramStats/StatsTracking.h" #include "CommonFramework/VideoPipeline/VideoFeed.h" @@ -386,8 +387,18 @@ bool RideCloner101::run_post_win( ssf_press_button(context, BUTTON_A, A_TO_B_DELAY0, 160ms); pbf_press_button(context, BUTTON_B, 160ms, 1840ms); } - }catch (OperationFailedException& e){ - e.send_notification(env, NOTIFICATION_ERROR_RECOVERABLE); + }catch (OperationFailedExceptionWithScreenshot& e){ + send_program_recoverable_error_notification(env, NOTIFICATION_ERROR_RECOVERABLE, e.message(), *e.screenshot()); + if (e.error_report_mode() == ErrorReport::SEND_ERROR_REPORT){ + PokemonAutomation::report_error( + &env.logger(), + env.program_info(), + "Recoverable: OperationFailedExceptionWithScreenshot", + {{"Message:", e.message()}}, + *e.screenshot(), + &e.video_stream()->history() + ); + } } continue; case 7: diff --git a/SerialPrograms/Source/PokemonSV/Programs/Glitches/PokemonSV_WildItemFarmer.cpp b/SerialPrograms/Source/PokemonSV/Programs/Glitches/PokemonSV_WildItemFarmer.cpp index 633bf7cf38..fb4e879f99 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/Glitches/PokemonSV_WildItemFarmer.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/Glitches/PokemonSV_WildItemFarmer.cpp @@ -4,7 +4,7 @@ * */ -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/Notifications/ProgramNotifications.h" #include "CommonFramework/ProgramStats/StatsTracking.h" #include "CommonTools/Images/SolidColorTest.h" @@ -184,7 +184,7 @@ void WildItemFarmer::refresh_pp(SingleSwitchProgramEnvironment& env, ProControll continue; default: - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "No state detected while changing moves after 10 seconds.", env.console @@ -218,7 +218,7 @@ bool WildItemFarmer::verify_item_held(SingleSwitchProgramEnvironment& env, ProCo break; default: - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Unable to detect " + Pokemon::STRING_POKEMON + " select menu.", env.console @@ -242,7 +242,7 @@ bool WildItemFarmer::verify_item_held(SingleSwitchProgramEnvironment& env, ProCo {battle_menu} ); if (ret < 0){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Unable to back out to battle menu.", env.console @@ -320,7 +320,7 @@ void WildItemFarmer::run_program(SingleSwitchProgramEnvironment& env, ProControl if (consecutive_throw_attempts >= MANUVERS.size()){ stats.errors++; env.update_stats(); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::NO_ERROR_REPORT, "Failed to start battle after " + std::to_string(MANUVERS.size()) + " attempts.", env.console @@ -363,7 +363,7 @@ void WildItemFarmer::run_program(SingleSwitchProgramEnvironment& env, ProControl }else{ stats.failed++; env.update_stats(); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::NO_ERROR_REPORT, "Failed to clone item. Possible incorrect encounter.", env.console @@ -452,7 +452,7 @@ void WildItemFarmer::run_program(SingleSwitchProgramEnvironment& env, ProControl continue; default: - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "No state detected after 120 seconds.", env.console diff --git a/SerialPrograms/Source/PokemonSV/Programs/ItemPrinter/PokemonSV_AutoItemPrinter.cpp b/SerialPrograms/Source/PokemonSV/Programs/ItemPrinter/PokemonSV_AutoItemPrinter.cpp index 9e16323b12..87a68104e7 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/ItemPrinter/PokemonSV_AutoItemPrinter.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/ItemPrinter/PokemonSV_AutoItemPrinter.cpp @@ -4,7 +4,7 @@ * */ -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/Notifications/ProgramNotifications.h" #include "CommonFramework/ProgramStats/StatsTracking.h" #include "CommonTools/Async/InferenceRoutines.h" @@ -112,7 +112,7 @@ void AutoItemPrinter::enter_printing_mode(SingleSwitchProgramEnvironment& env, P pbf_press_button(context, BUTTON_A, 160ms, 840ms); continue; default: - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "enter_printing_mode(): No recognized state after 120 seconds.", env.console diff --git a/SerialPrograms/Source/PokemonSV/Programs/ItemPrinter/PokemonSV_ItemPrinterRNG.cpp b/SerialPrograms/Source/PokemonSV/Programs/ItemPrinter/PokemonSV_ItemPrinterRNG.cpp index 965472844c..908c27f7b3 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/ItemPrinter/PokemonSV_ItemPrinterRNG.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/ItemPrinter/PokemonSV_ItemPrinterRNG.cpp @@ -8,7 +8,7 @@ #include "Common/Qt/TimeQt.h" #include "CommonFramework/StaticGlobals.h" #include "CommonFramework/Exceptions/ProgramFinishedException.h" -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/Notifications/ProgramNotifications.h" #include "CommonFramework/ProgramStats/StatsTracking.h" #include "CommonFramework/VideoPipeline/VideoOverlayScopes.h" @@ -325,7 +325,7 @@ ItemPrinterPrizeResult ItemPrinterRNG::run_print_at_date( std::chrono::seconds next_wait_time = std::chrono::seconds(120); while (true){ if (failures >= 5){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Unable to print after 5 attempts.", env.console @@ -456,7 +456,7 @@ ItemPrinterPrizeResult ItemPrinterRNG::run_print_at_date( env.update_stats(); env.console.log("No state detected after 2 minutes.", COLOR_RED); #if 0 - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "No state detected after 2 minutes.", env.console @@ -632,7 +632,7 @@ void ItemPrinterRNG::print_again( default: stats.errors++; env.update_stats(); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "No state detected after 2 minutes.", env.console @@ -1020,7 +1020,7 @@ uint32_t ItemPrinterRNG::check_num_happiny_dust( default: stats.errors++; env.update_stats(); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "No state detected after 2 minutes.", env.console diff --git a/SerialPrograms/Source/PokemonSV/Programs/ItemPrinter/PokemonSV_ItemPrinterTools.cpp b/SerialPrograms/Source/PokemonSV/Programs/ItemPrinter/PokemonSV_ItemPrinterTools.cpp index 820860503b..29b980485e 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/ItemPrinter/PokemonSV_ItemPrinterTools.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/ItemPrinter/PokemonSV_ItemPrinterTools.cpp @@ -4,7 +4,7 @@ * */ -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/VideoPipeline/VideoFeed.h" #include "CommonTools/Async/InferenceRoutines.h" #include "NintendoSwitch/Commands/NintendoSwitch_Commands_PushButtons.h" @@ -65,7 +65,7 @@ void item_printer_start_print( continue; } default: - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "start_print(): No recognized state after 120 seconds.", stream @@ -126,7 +126,7 @@ ItemPrinterPrizeResult item_printer_finish_print( continue; } default: - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "finish_print(): No recognized state after 120 seconds.", stream diff --git a/SerialPrograms/Source/PokemonSV/Programs/PokemonSV_AreaZero.cpp b/SerialPrograms/Source/PokemonSV/Programs/PokemonSV_AreaZero.cpp index 3ddce81db3..913c0a568d 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/PokemonSV_AreaZero.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/PokemonSV_AreaZero.cpp @@ -4,7 +4,7 @@ * */ -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonTools/VisualDetectors/BlackScreenDetector.h" #include "CommonTools/Async/InferenceRoutines.h" #include "NintendoSwitch/Commands/NintendoSwitch_Commands_PushButtons.h" @@ -38,7 +38,7 @@ void inside_zero_gate_to_station( {dialog} ); if (ret < 0){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Unable to find warp circle.", stream @@ -51,7 +51,7 @@ void inside_zero_gate_to_station( WallClock start = current_time(); while (true){ if (current_time() - start > std::chrono::seconds(60)){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Unable to warp to station after 60 seconds.", stream @@ -82,7 +82,7 @@ void inside_zero_gate_to_station( stream.log("Black screen is over. Arrive at station."); break; default: - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Unable to find warp to station 2.", stream @@ -132,7 +132,7 @@ void inside_zero_gate_to_station( continue; } default: - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Heal at station: No state detected after 30 seconds.", stream @@ -157,7 +157,7 @@ void inside_zero_gate_to_station( {black_screen} ); if (ret < 0){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Unable to exit station after 60 seconds.", stream @@ -173,7 +173,7 @@ void inside_zero_gate_to_station( {overworld} ); if (ret < 0){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Unable to load overworld after exiting station for 30 seconds.", stream @@ -207,7 +207,7 @@ void return_to_inside_zero_gate( {black_screen} ); if (ret < 0){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Unable to enter Zero Gate.", stream @@ -220,7 +220,7 @@ void return_to_inside_zero_gate( {overworld} ); if (ret < 0){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Unable to detect overworld inside Zero Gate.", stream @@ -242,7 +242,7 @@ void return_to_inside_zero_gate_from_picnic( {black_screen} ); if (ret < 0){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Unable to enter Zero Gate.", stream @@ -255,7 +255,7 @@ void return_to_inside_zero_gate_from_picnic( {overworld} ); if (ret < 0){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Unable to detect overworld inside Zero Gate.", stream diff --git a/SerialPrograms/Source/PokemonSV/Programs/PokemonSV_ConnectToInternet.cpp b/SerialPrograms/Source/PokemonSV/Programs/PokemonSV_ConnectToInternet.cpp index 109d73b771..16e8fa1c2e 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/PokemonSV_ConnectToInternet.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/PokemonSV_ConnectToInternet.cpp @@ -4,7 +4,7 @@ * */ -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/Tools/ErrorDumper.h" #include "CommonTools/Images/SolidColorTest.h" #include "CommonTools/Async/InferenceRoutines.h" @@ -75,7 +75,7 @@ void connect_to_internet_from_menu(const ProgramInfo& info, VideoStream& stream, bool connected = false; while (true){ if (current_time() - start > std::chrono::minutes(5)){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "connect_to_internet_from_menu(): Failed to connect to internet after 5 minutes.", stream @@ -125,13 +125,13 @@ void connect_to_internet_from_menu(const ProgramInfo& info, VideoStream& stream, continue; case 5: stream.log("Detected battle menu..."); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::NO_ERROR_REPORT, "connect_to_internet_from_menu(): Looks like you got attacked.", stream ); default: - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "connect_to_internet_from_menu(): No recognized state after 60 seconds.", stream @@ -144,7 +144,7 @@ void connect_to_internet_from_overworld(const ProgramInfo& info, VideoStream& st bool connected = false; while (true){ if (current_time() - start > std::chrono::minutes(5)){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "connect_to_internet_from_overworld(): Failed to connect to internet after 5 minutes.", stream @@ -205,13 +205,13 @@ void connect_to_internet_from_overworld(const ProgramInfo& info, VideoStream& st continue; case 5: stream.log("Detected battle menu..."); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::NO_ERROR_REPORT, "connect_to_internet_from_overworld(): Looks like you got attacked.", stream ); default: - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "connect_to_internet_from_overworld(): No recognized state after 60 seconds.", stream diff --git a/SerialPrograms/Source/PokemonSV/Programs/PokemonSV_GameEntry.cpp b/SerialPrograms/Source/PokemonSV/Programs/PokemonSV_GameEntry.cpp index 56451b9935..f3cd3c6c44 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/PokemonSV_GameEntry.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/PokemonSV_GameEntry.cpp @@ -5,7 +5,7 @@ */ #include "CommonFramework/Exceptions/FatalProgramException.h" -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/VideoPipeline/VideoOverlayScopes.h" #include "CommonFramework/Tools/ErrorDumper.h" #include "CommonFramework/Tools/ProgramEnvironment.h" @@ -160,16 +160,16 @@ void reset_game( pbf_press_button(context, BUTTON_HOME, 160ms, GameSettings::instance().GAME_TO_HOME_DELAY1); context.wait_for_all_requests(); if (!reset_game_from_home(info, console, context, 5000ms)){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Failed to start game.", console ); } - }catch (OperationFailedException& e){ + }catch (OperationFailedExceptionWithScreenshot& e){ // To be safe: avoid doing anything outside of game on Switch, // make game resetting non error recoverable - throw FatalProgramException(std::move(e)); + throw FatalProgramException(e.error_report_mode(), e.message(), e.video_stream(), e.screenshot()); } } diff --git a/SerialPrograms/Source/PokemonSV/Programs/PokemonSV_MenuNavigation.cpp b/SerialPrograms/Source/PokemonSV/Programs/PokemonSV_MenuNavigation.cpp index 1f9956bae6..f4d3c3a23a 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/PokemonSV_MenuNavigation.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/PokemonSV_MenuNavigation.cpp @@ -3,7 +3,7 @@ */ #include "Common/Cpp/RecursiveThrottler.h" -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/Exceptions/UnexpectedBattleException.h" #include "CommonTools/Async/InferenceRoutines.h" #include "NintendoSwitch/NintendoSwitch_Settings.h" @@ -157,7 +157,7 @@ void press_Bs_to_back_to_overworld(const ProgramInfo& info, VideoStream& stream, stream ); }else if (ret < 0){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "press_Bs_to_back_to_overworld(): Unable to detect overworld after 10 button B presses.", stream @@ -192,7 +192,7 @@ void open_map_from_overworld( stream ); }else{ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "open_map_from_overworld(): No overworld state found after 10 seconds.", stream @@ -203,7 +203,7 @@ void open_map_from_overworld( WallClock start = current_time(); while (true){ if (current_time() - start > std::chrono::minutes(2)){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "open_map_from_overworld(): Failed to open map after 2 minutes.", stream @@ -259,7 +259,7 @@ void open_map_from_overworld( stream ); default: - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "open_map_from_overworld(): No recognized state after 30 seconds.", stream @@ -279,7 +279,7 @@ void enter_box_system_from_overworld( bool success = false; while (true){ if (current_time() - start > std::chrono::minutes(3)){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "enter_box_system_from_overworld(): Failed to enter box system after 3 minutes.", stream @@ -307,7 +307,7 @@ void enter_box_system_from_overworld( stream.overlay().add_log("Enter box", COLOR_WHITE); success = main_menu.move_cursor(info, stream, context, MenuSide::RIGHT, 1, fast_mode); if (success == false){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "enter_box_system_from_overworld(): Cannot move menu cursor to Boxes.", stream @@ -320,7 +320,7 @@ void enter_box_system_from_overworld( context.wait_for(std::chrono::milliseconds(200)); return; default: - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "enter_box_system_from_overworld(): No recognized state after 30 seconds.", stream @@ -342,7 +342,7 @@ void open_pokedex_from_overworld(const ProgramInfo& info, VideoStream& stream, P WallClock start = current_time(); while (true){ if (current_time() - start > std::chrono::seconds(30)){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "open_pokedex_from_overworld(): Failed to open Pokédex after 30 seconds.", stream @@ -368,7 +368,7 @@ void open_pokedex_from_overworld(const ProgramInfo& info, VideoStream& stream, P stream.log("Detected Pokédex."); return; default: - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "open_pokedex_from_overworld(): No recognized state after 30 seconds.", stream @@ -397,7 +397,7 @@ void open_recently_battled_from_pokedex(const ProgramInfo& info, VideoStream& st pbf_mash_button(context, BUTTON_A, 1200ms); pbf_wait(context, 1600ms); }else{ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "open_recently_battled_from_pokedex(): Unknown state after 10 dpad down presses.", stream @@ -440,7 +440,7 @@ void leave_phone_to_overworld(const ProgramInfo& info, VideoStream& stream, ProC stream ); default: - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "leave_phone_to_overworld(): Unknown state after 10 button Y presses.", stream @@ -467,7 +467,7 @@ void mash_button_till_overworld( ); if (ret < 0){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "mash_button_till_overworld(): Timed out, no recognized state found.", stream @@ -489,7 +489,7 @@ void enter_menu_from_overworld(const ProgramInfo& info, VideoStream& stream, Pro while (true){ if (current_time() - start > std::chrono::minutes(1)){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "enter_menu_from_overworld(): Failed to enter specified menu after 1 minute.", stream @@ -529,7 +529,7 @@ void enter_menu_from_overworld(const ProgramInfo& info, VideoStream& stream, Pro } success = main_menu.move_cursor(info, stream, context, side, menu_index, fast_mode); if (success == false){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "enter_menu_from_overworld(): Cannot move menu cursor to specified menu.", stream @@ -544,7 +544,7 @@ void enter_menu_from_overworld(const ProgramInfo& info, VideoStream& stream, Pro stream ); default: - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "enter_menu_from_overworld(): No recognized state after 30 seconds. Can't find overworld or main menu.", stream @@ -562,7 +562,7 @@ void enter_menu_from_box_system(const ProgramInfo& info, VideoStream& stream, Pr while (true){ if (current_time() - start > std::chrono::seconds(20)){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "enter_menu_from_box_system(): Failed to enter specified menu after 20 seconds.", stream @@ -592,7 +592,7 @@ void enter_menu_from_box_system(const ProgramInfo& info, VideoStream& stream, Pr } success = main_menu.move_cursor(info, stream, context, side, menu_index, fast_mode); if (success == false){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "enter_menu_from_box_system(): Cannot move menu cursor to specified menu.", stream @@ -601,7 +601,7 @@ void enter_menu_from_box_system(const ProgramInfo& info, VideoStream& stream, Pr pbf_press_button(context, BUTTON_A, 160ms, 840ms); return; default: - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "enter_menu_from_box_system(): No recognized state after 30 seconds.", stream @@ -620,7 +620,7 @@ void enter_menu_from_bag(const ProgramInfo& info, VideoStream& stream, ProContro while (true){ if (current_time() - start > std::chrono::seconds(20)){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "enter_menu_from_bag(): Failed to enter specified menu after 20 seconds.", stream @@ -651,7 +651,7 @@ void enter_menu_from_bag(const ProgramInfo& info, VideoStream& stream, ProContro } success = main_menu.move_cursor(info, stream, context, side, menu_index, fast_mode); if (success == false){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "enter_menu_from_bag(): Cannot move menu cursor to specified menu.", stream @@ -664,7 +664,7 @@ void enter_menu_from_bag(const ProgramInfo& info, VideoStream& stream, ProContro pbf_press_button(context, BUTTON_B, 160ms, 840ms); continue; default: - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "enter_menu_from_bag(): No recognized state after 30 seconds.", stream @@ -681,7 +681,7 @@ void enter_bag_from_menu(const ProgramInfo& info, VideoStream& stream, ProContro while (true){ if (current_time() - start > std::chrono::seconds(20)){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "enter_bag_from_menu(): Failed to enter specified menu after 20 seconds.", stream @@ -704,7 +704,7 @@ void enter_bag_from_menu(const ProgramInfo& info, VideoStream& stream, ProContro stream.log("Detected main menu."); success = main_menu.move_cursor(info, stream, context, MenuSide::RIGHT, 0, fast_mode); if (success == false){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "enter_bag_from_menu(): Cannot move menu cursor to specified menu.", stream @@ -716,7 +716,7 @@ void enter_bag_from_menu(const ProgramInfo& info, VideoStream& stream, ProContro stream.overlay().add_log("Enter bag"); return; default: - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "enter_bag_from_menu(): No recognized state after 30 seconds.", stream @@ -748,7 +748,7 @@ void press_button_until_gradient_arrow( if (ret == 0){ stream.log("Gradient arrow detected."); }else{ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Failed to detect gradient arrow.", stream @@ -769,7 +769,7 @@ void navigate_school_layout_menu( int ret = wait_until(stream, context, Milliseconds(5000), { arrow_start }); if (ret < 0){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "navigate_school_layout_menu: Failed to detect gradient arrow at expected start position.", stream @@ -795,7 +795,7 @@ void navigate_school_layout_menu( if (ret == 0){ stream.log("navigate_school_layout_menu: Desired item selected."); }else{ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "navigate_school_layout_menu: Failed to detect gradient arrow at expected end position.", stream diff --git a/SerialPrograms/Source/PokemonSV/Programs/PokemonSV_SaveGame.cpp b/SerialPrograms/Source/PokemonSV/Programs/PokemonSV_SaveGame.cpp index 99e2f50194..ede1f31e0c 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/PokemonSV_SaveGame.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/PokemonSV_SaveGame.cpp @@ -4,7 +4,7 @@ * */ -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/Tools/ErrorDumper.h" #include "CommonTools/Async/InferenceRoutines.h" #include "NintendoSwitch/Commands/NintendoSwitch_Commands_PushButtons.h" @@ -49,7 +49,7 @@ void save_game_from_menu_or_overworld( bool saved = false; while (true){ if (current_time() - start > std::chrono::minutes(5)){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "save_game_from_menu_or_overworld(): Failed to save game after 5 minutes.", stream @@ -97,7 +97,7 @@ void save_game_from_menu_or_overworld( saved = true; continue; default: - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "save_game_from_menu_or_overworld(): No recognized state after 60 seconds.", stream @@ -133,7 +133,7 @@ void save_game_tutorial( {menu} ); if (ret0 != 0){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Failed to open menu!", stream diff --git a/SerialPrograms/Source/PokemonSV/Programs/PokemonSV_Terarium.cpp b/SerialPrograms/Source/PokemonSV/Programs/PokemonSV_Terarium.cpp index 2201b1dc57..4f2444d00b 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/PokemonSV_Terarium.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/PokemonSV_Terarium.cpp @@ -4,7 +4,7 @@ * */ -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/Tools/ErrorDumper.h" #include "CommonFramework/Exceptions/ProgramFinishedException.h" #include "CommonTools/Async/InferenceRoutines.h" @@ -101,7 +101,7 @@ void return_to_plaza(const ProgramInfo& info, VideoStream& stream, ProController pbf_press_button(context, BUTTON_A, 80ms, 400ms); }catch (...){ stream.log("Unable to flee."); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Unable to flee!", stream @@ -134,7 +134,7 @@ void map_move_cursor_fly( stream.log("Failed to fly! Closing map and retrying."); press_Bs_to_back_to_overworld(info, stream, context); if (i == 2){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Unable to fly to " + location + "!", stream diff --git a/SerialPrograms/Source/PokemonSV/Programs/PokemonSV_WorldNavigation.cpp b/SerialPrograms/Source/PokemonSV/Programs/PokemonSV_WorldNavigation.cpp index d147bfec6f..90cf4c8530 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/PokemonSV_WorldNavigation.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/PokemonSV_WorldNavigation.cpp @@ -2,7 +2,7 @@ * */ -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/Exceptions/UnexpectedBattleException.h" #include "CommonTools/Async/InferenceRoutines.h" //#include "NintendoSwitch/NintendoSwitch_Settings.h" @@ -49,7 +49,7 @@ bool fly_to_overworld_from_map(const ProgramInfo& info, VideoStream& stream, Pro WallClock start = current_time(); while (true){ if (current_time() - start > std::chrono::minutes(2)){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "fly_to_overworld_from_map(): Failed to fly from map after 2 minutes.", stream @@ -105,7 +105,7 @@ bool fly_to_overworld_from_map(const ProgramInfo& info, VideoStream& stream, Pro stream.overlay().add_log("No fly spot", COLOR_RED); return false; default: - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "fly_to_overworld_from_map(): No recognized state after 2 minutes.", stream @@ -122,7 +122,7 @@ void picnic_from_overworld(const ProgramInfo& info, VideoStream& stream, ProCont bool success = false; while (true){ if (current_time() - start > std::chrono::minutes(3)){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "picnic_from_overworld(): Failed to start picnic after 3 minutes.", stream @@ -149,7 +149,7 @@ void picnic_from_overworld(const ProgramInfo& info, VideoStream& stream, ProCont stream.log("Detected main menu."); success = main_menu.move_cursor(info, stream, context, MenuSide::RIGHT, 2, fast_mode); if (success == false){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "picnic_from_overworld(): Cannot move menu cursor to picnic.", stream @@ -166,7 +166,7 @@ void picnic_from_overworld(const ProgramInfo& info, VideoStream& stream, ProCont context.wait_for_all_requests(); return; default: - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "picnic_from_overworld(): No recognized state after 30 seconds.", stream @@ -196,7 +196,7 @@ void leave_picnic(const ProgramInfo& info, VideoStream& stream, ProControllerCon } if (i == 4){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "leave_picnic(): Failed to leave picnic after 5 tries.", stream @@ -220,7 +220,7 @@ void leave_picnic(const ProgramInfo& info, VideoStream& stream, ProControllerCon {overworld} ); if (ret < 0){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "leave_picnic(): Failed to detect overworld after 20 seconds.", stream @@ -295,7 +295,7 @@ void place_marker_offset_from_flypoint( while (true){ if (current_time() - start > std::chrono::minutes(2)){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "place_marker_offset_from_flypoint(): Failed to place down marker after 2 minutes.", stream @@ -355,7 +355,7 @@ void move_cursor_to_position_offset_from_flypoint(const ProgramInfo& info, Video for (size_t i = 0; i < MAX_ATTEMPTS; i++){ const std::vector found_locations = get_flypoint_locations(info, stream, context, fly_point); if (found_locations.empty()){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "move_cursor_to_position_offset_from_flypoint(): No visible " + fly_point_string + " found on map", stream @@ -521,7 +521,7 @@ bool fly_to_visible_closest_flypoint_cur_zoom_level( return true; }else{ // detected pokecenter, but failed to fly there. - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "fly_to_visible_closest_flypoint_cur_zoom_level(): Detected pokecenter, but failed to fly there as no \"Fly\" menuitem.", stream @@ -557,7 +557,7 @@ void fly_to_closest_pokecenter_on_map(const ProgramInfo& info, VideoStream& stre }catch (OperationFailedException&){ // pokecenter was detected, but failed to fly there try_count++; if (try_count >= MAX_TRY_COUNT){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "fly_to_closest_pokecenter_on_map(): At min warpable map level, pokecenter was detected, but failed to fly there.", stream @@ -600,7 +600,7 @@ void fly_to_closest_pokecenter_on_map(const ProgramInfo& info, VideoStream& stre }else{ // Does not detect any pokecenter on map stream.overlay().add_log("Still no PokeCenter Found!", COLOR_RED); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "fly_to_closest_pokecenter_on_map(): At max warpable map level, still cannot find PokeCenter icon.", stream @@ -638,7 +638,7 @@ void jump_off_wall_until_map_open(const ProgramInfo& info, VideoStream& stream, } if (i >= 3){ stream.log("Could not escape wall."); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "jump_off_wall_until_map_open(): Could not escape wall.", stream @@ -697,7 +697,7 @@ void walk_forward_until_dialog( stream.log("walk_forward_until_dialog(): Detected dialog."); return; default: - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "walk_forward_until_dialog(): Timed out. Did not detect dialog.", stream @@ -762,7 +762,7 @@ bool attempt_fly_to_overlapping_flypoint( void fly_to_overlapping_flypoint(const ProgramInfo& info, VideoStream& stream, ProControllerContext& context){ if (!attempt_fly_to_overlapping_flypoint(info, stream, context)){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Failed to reset to overlapping Pokecenter.", stream @@ -772,7 +772,7 @@ void fly_to_overlapping_flypoint(const ProgramInfo& info, VideoStream& stream, P void confirm_no_overlapping_flypoint(const ProgramInfo& info, VideoStream& stream, ProControllerContext& context){ if (attempt_fly_to_overlapping_flypoint(info, stream, context)){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Overlapping fly detected, when it wasn't expected.", stream @@ -789,7 +789,7 @@ void heal_at_pokecenter( context.wait_for_all_requests(); // if (!attempt_fly_to_overlapping_flypoint(info, stream, context)){ - // OperationFailedException::fire( + // OperationFailedExceptionWithScreenshot::fire( // ErrorReport::SEND_ERROR_REPORT, // "Failed to fly to pokecenter.", // stream @@ -846,7 +846,7 @@ void heal_at_pokecenter( break; default: stream.log("heal_at_pokecenter: Timed out."); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Failed to heal at pokecenter.", stream @@ -930,7 +930,7 @@ void run_battle_press_A( ); context.wait_for(std::chrono::milliseconds(100)); if (ret < 0){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "run_battle_press_A(): Timed out. Did not detect expected stop condition.", stream @@ -956,7 +956,7 @@ void run_battle_press_A( return; } if(num_times_seen_overworld > 30){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "run_battle_press_A(): Stuck in overworld. Did not detect expected stop condition.", stream @@ -972,7 +972,7 @@ void run_battle_press_A( VideoSnapshot screen = stream.video().snapshot(); // dump_snapshot(console); if (wipeout.detect(screen)){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "run_battle_press_A(): Detected wipeout. All pokemon fainted.", stream @@ -994,7 +994,7 @@ void run_battle_press_A( pbf_mash_button(context, BUTTON_B, 800ms); break; case CallbackEnum::SWAP_MENU: - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "run_battle_press_A(): Lead pokemon fainted.", stream diff --git a/SerialPrograms/Source/PokemonSV/Programs/Sandwiches/PokemonSV_IngredientSession.cpp b/SerialPrograms/Source/PokemonSV/Programs/Sandwiches/PokemonSV_IngredientSession.cpp index db368dfd02..77ac314104 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/Sandwiches/PokemonSV_IngredientSession.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/Sandwiches/PokemonSV_IngredientSession.cpp @@ -6,7 +6,7 @@ #include #include "Common/Cpp/Containers/FixedLimitVector.tpp" -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/Tools/GlobalThreadPools.h" #include "CommonFramework/VideoPipeline/VideoFeed.h" #include "NintendoSwitch/Commands/NintendoSwitch_Commands_PushButtons.h" @@ -61,7 +61,7 @@ PageIngredients IngredientSession::read_screen(std::shared_ptr // Step 1: Detect the cyan gradient arrow that indicates cursor position if (!m_arrow.detect(box, *screen)){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "IngredientSession::read_current_page(): Unable to find cursor.", m_stream @@ -75,7 +75,7 @@ PageIngredients IngredientSession::read_screen(std::shared_ptr // Throws if cursor is not within expected range (0-9 for 10 lines per page) if (ret.selected < 0 || ret.selected >= 10){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "IngredientSession::read_current_page(): Invalid cursor slot.", m_stream, @@ -141,7 +141,7 @@ PageIngredients IngredientSession::read_screen(std::shared_ptr for (const auto& p : image_result.results){ sprite_result.insert(p.second); } - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "IngredientSession::read_current_page(): Unable to read selected item. OCR and sprite do not agree on any match: ocr " + set_to_str(ocr_result) + ", sprite " + set_to_str(sprite_result), @@ -156,7 +156,7 @@ PageIngredients IngredientSession::read_screen(std::shared_ptr for (const auto& p : image_result.results){ sprite_result.insert(p.second); } - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "IngredientSession::read_current_page(): Unable to read selected item. Ambiguous result: " + set_to_str(ocr_result) + ", " + set_to_str(sprite_result) + "\n" + language_warning(m_language), @@ -298,7 +298,7 @@ void IngredientSession::add_ingredients( std::string found = this->move_to_ingredient(ingredients); if (found.empty()){ const SandwichIngredientNames& name = get_ingredient_name(ingredients.begin()->first); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::NO_ERROR_REPORT, "Unable to find ingredient: \"" + name.display_name() + "\" - Did you run out?", stream @@ -338,7 +338,7 @@ void IngredientSession::add_ingredients( } if (!ingredient_added){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::NO_ERROR_REPORT, "Unable to add ingredient: \"" + name.display_name() + "\" - Did you run out?", stream diff --git a/SerialPrograms/Source/PokemonSV/Programs/Sandwiches/PokemonSV_SandwichRoutines.cpp b/SerialPrograms/Source/PokemonSV/Programs/Sandwiches/PokemonSV_SandwichRoutines.cpp index 04b0e7d71c..010d9d5084 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/Sandwiches/PokemonSV_SandwichRoutines.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/Sandwiches/PokemonSV_SandwichRoutines.cpp @@ -10,7 +10,7 @@ #include #include "Common/Cpp/Exceptions.h" #include "CommonFramework/StaticGlobals.h" -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/VideoPipeline/VideoFeed.h" #include "CommonFramework/VideoPipeline/VideoOverlay.h" #include "CommonFramework/Tools/ErrorDumper.h" @@ -1100,7 +1100,7 @@ void run_sandwich_maker( continue; }else{ stream.log("Read nothing on center plate label."); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "run_sandwich_maker: No ingredient found on center plate label.\n" + language_warning(language), stream, @@ -1150,7 +1150,7 @@ void run_sandwich_maker( left_filling = left_plate_detector.detect_filling_name(screen); if (left_filling.empty()){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "No ingredient label found on remaining plate " + std::to_string(i) + ".", stream, @@ -1172,7 +1172,7 @@ void run_sandwich_maker( //If a label fails to read it'll cause issues down the line if ((int)plate_order.size() != plates){ env.log("Found # plate labels " + std::to_string(plate_order.size()) + ", not same as desired # plates " + std::to_string(plates)); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Number of plate labels did not match number of plates.", stream, @@ -1238,7 +1238,7 @@ void run_sandwich_maker( stream.log("There's only one plate, so we assume it's the expected filling."); plate_index.push_back(0); }else{ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "run_sandwich_maker(): Did not detect the expected ingredients on the plate(s).", stream @@ -1341,7 +1341,7 @@ void run_sandwich_maker( SandwichHandWatcher grabbing_hand(SandwichHandType::GRABBING, { 0, 0, 1.0, 1.0 }); int ret = wait_until(stream, context, std::chrono::seconds(30), { grabbing_hand }); if (ret < 0){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "SandwichMaker: Cannot detect grabbing hand when waiting for upper bread.", stream, diff --git a/SerialPrograms/Source/PokemonSV/Programs/ShinyHunting/PokemonSV_LetsGoTools.cpp b/SerialPrograms/Source/PokemonSV/Programs/ShinyHunting/PokemonSV_LetsGoTools.cpp index bffcec558c..9fbf6cc53a 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/ShinyHunting/PokemonSV_LetsGoTools.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/ShinyHunting/PokemonSV_LetsGoTools.cpp @@ -8,7 +8,7 @@ #include "Common/Cpp/PrettyPrint.h" #include "CommonFramework/Logging/Logger.h" #include "CommonFramework/Exceptions/ProgramFinishedException.h" -//#include "CommonFramework/Exceptions/OperationFailedException.h" +//#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" //#include "CommonFramework/Exceptions/FatalProgramException.h" #include "CommonFramework/Tools/ProgramEnvironment.h" #include "CommonTools/Async/InferenceRoutines.h" diff --git a/SerialPrograms/Source/PokemonSV/Programs/ShinyHunting/PokemonSV_ShinyHunt-AreaZeroPlatform.cpp b/SerialPrograms/Source/PokemonSV/Programs/ShinyHunting/PokemonSV_ShinyHunt-AreaZeroPlatform.cpp index 52b9c0b524..e6628e5974 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/ShinyHunting/PokemonSV_ShinyHunt-AreaZeroPlatform.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/ShinyHunting/PokemonSV_ShinyHunt-AreaZeroPlatform.cpp @@ -7,8 +7,9 @@ #include #include "Common/Cpp/PrettyPrint.h" #include "CommonFramework/StaticGlobals.h" +#include "CommonFramework/ErrorReports/ErrorReports.h" #include "CommonFramework/Exceptions/ProgramFinishedException.h" -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/Exceptions/FatalProgramException.h" #include "CommonFramework/Notifications/ProgramNotifications.h" #include "CommonFramework/ProgramStats/StatsTracking.h" @@ -458,11 +459,21 @@ void ShinyHuntAreaZeroPlatform::set_flags_and_run_state( try{ run_state(env, context); - }catch (OperationFailedException& e){ + }catch (OperationFailedExceptionWithScreenshot& e){ stats.m_errors++; m_env->update_stats(); m_consecutive_failures++; - e.send_notification(*m_env, NOTIFICATION_ERROR_RECOVERABLE); + send_program_recoverable_error_notification(env, NOTIFICATION_ERROR_RECOVERABLE, e.message(), *e.screenshot()); + if (e.error_report_mode() == ErrorReport::SEND_ERROR_REPORT){ + PokemonAutomation::report_error( + &env.logger(), + env.program_info(), + "Recoverable: OperationFailedExceptionWithScreenshot", + {{"Message:", e.message()}}, + *e.screenshot(), + &e.video_stream()->history() + ); + } if (m_consecutive_failures >= 3){ throw_and_log( stream.logger(), diff --git a/SerialPrograms/Source/PokemonSV/Programs/ShinyHunting/PokemonSV_ShinyHunt-Scatterbug.cpp b/SerialPrograms/Source/PokemonSV/Programs/ShinyHunting/PokemonSV_ShinyHunt-Scatterbug.cpp index f543e6d085..dd845573fe 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/ShinyHunting/PokemonSV_ShinyHunt-Scatterbug.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/ShinyHunting/PokemonSV_ShinyHunt-Scatterbug.cpp @@ -8,7 +8,8 @@ #include "Common/Cpp/PrettyPrint.h" #include "CommonFramework/StaticGlobals.h" #include "CommonFramework/Exceptions/ProgramFinishedException.h" -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/ErrorReports/ErrorReports.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/Notifications/ProgramNotifications.h" #include "CommonFramework/ProgramStats/StatsTracking.h" #include "CommonFramework/Tools/ErrorDumper.h" @@ -187,10 +188,20 @@ void ShinyHuntScatterbug::program(SingleSwitchProgramEnvironment& env, ProContro try{ run_one_sandwich_iteration(env, context); consecutive_failures = 0; - }catch (OperationFailedException& e){ + }catch (OperationFailedExceptionWithScreenshot& e){ stats.m_errors++; env.update_stats(); - e.send_notification(env, NOTIFICATION_ERROR_RECOVERABLE); + send_program_recoverable_error_notification(env, NOTIFICATION_ERROR_RECOVERABLE, e.message(), *e.screenshot()); + if (e.error_report_mode() == ErrorReport::SEND_ERROR_REPORT){ + PokemonAutomation::report_error( + &env.logger(), + env.program_info(), + "Recoverable: OperationFailedExceptionWithScreenshot", + {{"Message:", e.message()}}, + *e.screenshot(), + &e.video_stream()->history() + ); + } if (SAVE_DEBUG_VIDEO){ // Take a video to give more context for debugging @@ -208,7 +219,7 @@ void ShinyHuntScatterbug::program(SingleSwitchProgramEnvironment& env, ProContro consecutive_failures++; if (consecutive_failures >= 3){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Failed 3 times in the row.", env.console diff --git a/SerialPrograms/Source/PokemonSV/Programs/TeraRaids/PokemonSV_AutoHost.cpp b/SerialPrograms/Source/PokemonSV/Programs/TeraRaids/PokemonSV_AutoHost.cpp index 239f3de6b4..8de8575a48 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/TeraRaids/PokemonSV_AutoHost.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/TeraRaids/PokemonSV_AutoHost.cpp @@ -5,7 +5,8 @@ */ #include "Common/Cpp/PrettyPrint.h" -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/ErrorReports/ErrorReports.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/Notifications/ProgramNotifications.h" #include "CommonFramework/ProgramStats/StatsTracking.h" #include "CommonFramework/VideoPipeline/VideoOverlayScopes.h" @@ -144,7 +145,7 @@ WallClock AutoHost::wait_for_lobby_open( {{lobby, std::chrono::milliseconds(500)}} ); if (ret < 0){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Unable to detect Tera lobby after 60 seconds.", env.console @@ -223,7 +224,7 @@ bool AutoHost::start_raid( update_stats_on_raid_start(env, player_count); return true; default: - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Stuck in lobby for 4 minutes.", env.console @@ -320,9 +321,19 @@ void AutoHost::program(SingleSwitchProgramEnvironment& env, ProControllerContext // Connect to internet. try{ connect_to_internet_from_overworld(env.program_info(), env.console, context); - }catch (OperationFailedException& e){ + }catch (OperationFailedExceptionWithScreenshot& e){ stats.m_errors++; - e.send_notification(env, NOTIFICATION_ERROR_RECOVERABLE); + send_program_recoverable_error_notification(env, NOTIFICATION_ERROR_RECOVERABLE, e.message(), *e.screenshot()); + if (e.error_report_mode() == ErrorReport::SEND_ERROR_REPORT){ + PokemonAutomation::report_error( + &env.logger(), + env.program_info(), + "Recoverable: OperationFailedExceptionWithScreenshot", + {{"Message:", e.message()}}, + *e.screenshot(), + &e.video_stream()->history() + ); + } fail_tracker.report_raid_error(); continue; } @@ -341,9 +352,19 @@ void AutoHost::program(SingleSwitchProgramEnvironment& env, ProControllerContext try{ open_hosting_lobby(env, env.console, context, mode); - }catch (OperationFailedException& e){ + }catch (OperationFailedExceptionWithScreenshot& e){ stats.m_errors++; - e.send_notification(env, NOTIFICATION_ERROR_RECOVERABLE); + send_program_recoverable_error_notification(env, NOTIFICATION_ERROR_RECOVERABLE, e.message(), *e.screenshot()); + if (e.error_report_mode() == ErrorReport::SEND_ERROR_REPORT){ + PokemonAutomation::report_error( + &env.logger(), + env.program_info(), + "Recoverable: OperationFailedExceptionWithScreenshot", + {{"Message:", e.message()}}, + *e.screenshot(), + &e.video_stream()->history() + ); + } fail_tracker.report_raid_error(); continue; } @@ -381,9 +402,19 @@ void AutoHost::program(SingleSwitchProgramEnvironment& env, ProControllerContext exit_tera_win_without_catching(env.program_info(), env.console, context, 0); } fail_tracker.report_successful_raid(); - }catch (OperationFailedException& e){ + }catch (OperationFailedExceptionWithScreenshot& e){ stats.m_errors++; - e.send_notification(env, NOTIFICATION_ERROR_RECOVERABLE); + send_program_recoverable_error_notification(env, NOTIFICATION_ERROR_RECOVERABLE, e.message(), *e.screenshot()); + if (e.error_report_mode() == ErrorReport::SEND_ERROR_REPORT){ + PokemonAutomation::report_error( + &env.logger(), + env.program_info(), + "Recoverable: OperationFailedExceptionWithScreenshot", + {{"Message:", e.message()}}, + *e.screenshot(), + &e.video_stream()->history() + ); + } fail_tracker.report_raid_error(); continue; } diff --git a/SerialPrograms/Source/PokemonSV/Programs/TeraRaids/PokemonSV_TeraBattler.cpp b/SerialPrograms/Source/PokemonSV/Programs/TeraRaids/PokemonSV_TeraBattler.cpp index dae839aec3..9535147999 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/TeraRaids/PokemonSV_TeraBattler.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/TeraRaids/PokemonSV_TeraBattler.cpp @@ -5,7 +5,7 @@ */ #include "Common/Cpp/Concurrency/Mutex.h" -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/VideoPipeline/VideoFeed.h" #include "CommonTools/Async/InferenceRoutines.h" #include "NintendoSwitch/Commands/NintendoSwitch_Commands_PushButtons.h" @@ -345,7 +345,7 @@ bool run_tera_battle( default: consecutive_timeouts++; if (consecutive_timeouts == 3){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "No state detected after 6 minutes.", stream diff --git a/SerialPrograms/Source/PokemonSV/Programs/TeraRaids/PokemonSV_TeraMultiFarmer.cpp b/SerialPrograms/Source/PokemonSV/Programs/TeraRaids/PokemonSV_TeraMultiFarmer.cpp index 0f27515a33..48ebc6b0df 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/TeraRaids/PokemonSV_TeraMultiFarmer.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/TeraRaids/PokemonSV_TeraMultiFarmer.cpp @@ -6,7 +6,8 @@ #include "Common/Cpp/PrettyPrint.h" //#include "CommonFramework/GlobalSettingsPanel.h" -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/ErrorReports/ErrorReports.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/ProgramStats/StatsTracking.h" #include "CommonFramework/VideoPipeline/VideoFeed.h" #include "CommonFramework/Notifications/ProgramNotifications.h" @@ -359,7 +360,7 @@ bool TeraMultiFarmer::start_sequence_host( const char* error = normalize_code(lobby_code, code); if (error){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Unable to read raid code.", console @@ -617,10 +618,20 @@ void TeraMultiFarmer::program(MultiSwitchProgramEnvironment& env, CancellableSco ); } fail_tracker.report_successful_raid(); - }catch (OperationFailedException& e){ + }catch (OperationFailedExceptionWithScreenshot& e){ // cout << "caught: TeraMultiFarmer::program" << endl; - e.send_notification(env, NOTIFICATION_ERROR_RECOVERABLE); + send_program_recoverable_error_notification(env, NOTIFICATION_ERROR_RECOVERABLE, e.message(), *e.screenshot()); + if (e.error_report_mode() == ErrorReport::SEND_ERROR_REPORT){ + PokemonAutomation::report_error( + &env.logger(), + env.program_info(), + "Recoverable: OperationFailedExceptionWithScreenshot", + {{"Message:", e.message()}}, + *e.screenshot(), + &e.video_stream()->history() + ); + } if (RECOVERY_MODE != RecoveryMode::SAVE_AND_RESET){ // Iterate the errored Switches. If a non-host has errored, // rethrow the exception to stop the program. diff --git a/SerialPrograms/Source/PokemonSV/Programs/TeraRaids/PokemonSV_TeraRoutines.cpp b/SerialPrograms/Source/PokemonSV/Programs/TeraRaids/PokemonSV_TeraRoutines.cpp index 07c4813100..b62f5c64d4 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/TeraRaids/PokemonSV_TeraRoutines.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/TeraRaids/PokemonSV_TeraRoutines.cpp @@ -7,7 +7,7 @@ #include #include "Common/Cpp/Exceptions.h" #include "CommonFramework/Exceptions/ProgramFinishedException.h" -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/Exceptions/FatalProgramException.h" #include "CommonFramework/ErrorReports/ErrorReports.h" #include "CommonFramework/VideoPipeline/VideoFeed.h" @@ -165,7 +165,7 @@ void open_hosting_lobby( stream.log("Detected overworld."); recovery_mode = false; if (!open_raid(stream, context)){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "No Tera raid found.", stream @@ -394,7 +394,7 @@ void join_raid( ); pbf_press_button(context, BUTTON_B, 160ms, 840ms); -// OperationFailedException::fire( +// OperationFailedExceptionWithScreenshot::fire( // ErrorReport::SEND_ERROR_REPORT, // "join_raid(): No recognized state after 30 seconds.", // console, @@ -808,7 +808,7 @@ void run_from_tera_battle( while (true){ // Having a lot of Abilities activating can take a while, setting 3 minutes to be safe if (current_time() - start > std::chrono::minutes(3)){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "run_from_tera_battle(): Failed to run away from tera raid battle after 3 minutes.", stream @@ -864,7 +864,7 @@ void run_from_tera_battle( (*stat_errors)++; env.update_stats(); } - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "run_from_tera_battle(): No recognized state after 1 minutes.", stream diff --git a/SerialPrograms/Source/PokemonSwSh/MaxLair/Framework/PokemonSwSh_MaxLair_CatchScreenTracker.cpp b/SerialPrograms/Source/PokemonSwSh/MaxLair/Framework/PokemonSwSh_MaxLair_CatchScreenTracker.cpp index 90e6c30d20..c63361faae 100644 --- a/SerialPrograms/Source/PokemonSwSh/MaxLair/Framework/PokemonSwSh_MaxLair_CatchScreenTracker.cpp +++ b/SerialPrograms/Source/PokemonSwSh/MaxLair/Framework/PokemonSwSh_MaxLair_CatchScreenTracker.cpp @@ -4,7 +4,7 @@ * */ -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/VideoPipeline/VideoFeed.h" #include "CommonFramework/Tools/ErrorDumper.h" #include "CommonTools/Async/InferenceRoutines.h" @@ -90,7 +90,7 @@ void CaughtPokemonScreen::leave_summary(){ default: // auto snapshot = m_stream.video().snapshot(); // dump_image(m_stream, m_env.program_info(), "CaughtMenu", snapshot); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Failed to detect caught menu.", m_stream @@ -126,7 +126,7 @@ void CaughtPokemonScreen::process_detection(Detection detection){ CaughtPokemon& mon = m_mons[m_current_position]; switch (detection){ case SummaryShinySymbolDetector::Detection::NO_DETECTION: - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Failed to detect summary screen.", m_stream @@ -137,7 +137,7 @@ void CaughtPokemonScreen::process_detection(Detection detection){ mon.shiny = false; mon.read = true; }else if (mon.shiny){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Fatal Inconsistency: Expected to see a non-shiny.", m_stream @@ -150,7 +150,7 @@ void CaughtPokemonScreen::process_detection(Detection detection){ mon.shiny = true; mon.read = true; }else if (!mon.shiny){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Fatal Inconsistency: Expected to see a shiny.", m_stream diff --git a/SerialPrograms/Source/PokemonSwSh/MaxLair/Program/PokemonSwSh_MaxLair_Run_Battle.cpp b/SerialPrograms/Source/PokemonSwSh/MaxLair/Program/PokemonSwSh_MaxLair_Run_Battle.cpp index 4bd7b7d19f..caf29c712d 100644 --- a/SerialPrograms/Source/PokemonSwSh/MaxLair/Program/PokemonSwSh_MaxLair_Run_Battle.cpp +++ b/SerialPrograms/Source/PokemonSwSh/MaxLair/Program/PokemonSwSh_MaxLair_Run_Battle.cpp @@ -5,7 +5,7 @@ */ #include "Common/Cpp/PrettyPrint.h" -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/VideoPipeline/VideoFeed.h" #include "CommonFramework/Tools/ErrorDumper.h" #include "CommonTools/Async/InferenceRoutines.h" @@ -356,7 +356,7 @@ StateMachineAction throw_balls( if (balls != 0){ pbf_mash_button(context, BUTTON_A, 1000ms); }else{ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::NO_ERROR_REPORT, "Unable to find appropriate ball. Did you run out?", stream diff --git a/SerialPrograms/Source/PokemonSwSh/MaxLair/Program/PokemonSwSh_MaxLair_Run_EnterLobby.cpp b/SerialPrograms/Source/PokemonSwSh/MaxLair/Program/PokemonSwSh_MaxLair_Run_EnterLobby.cpp index 005d389481..ce5a2bf3d0 100644 --- a/SerialPrograms/Source/PokemonSwSh/MaxLair/Program/PokemonSwSh_MaxLair_Run_EnterLobby.cpp +++ b/SerialPrograms/Source/PokemonSwSh/MaxLair/Program/PokemonSwSh_MaxLair_Run_EnterLobby.cpp @@ -4,7 +4,7 @@ * */ -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/ImageTypes/ImageRGB32.h" #include "CommonFramework/ImageTools/ImageStats.h" #include "CommonFramework/VideoPipeline/VideoFeed.h" @@ -117,7 +117,7 @@ std::shared_ptr enter_lobby( ore.update_with_ocr(stream.logger(), filtered); if (ore.quantity < 20){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::NO_ERROR_REPORT, "You have less than 20 ore. Program stopped. (Quantity: " + ore.to_str() + ")", stream @@ -126,7 +126,7 @@ std::shared_ptr enter_lobby( ore_dialog_count++; if (ore_dialog_count >= 2){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::NO_ERROR_REPORT, "Unable to start adventure. Are you out of ore? (Quantity: " + ore.to_str() + ")", stream diff --git a/SerialPrograms/Source/PokemonSwSh/MaxLair/Program/PokemonSwSh_MaxLair_Run_Entrance.cpp b/SerialPrograms/Source/PokemonSwSh/MaxLair/Program/PokemonSwSh_MaxLair_Run_Entrance.cpp index 2016ab910f..2c686722f6 100644 --- a/SerialPrograms/Source/PokemonSwSh/MaxLair/Program/PokemonSwSh_MaxLair_Run_Entrance.cpp +++ b/SerialPrograms/Source/PokemonSwSh/MaxLair/Program/PokemonSwSh_MaxLair_Run_Entrance.cpp @@ -4,7 +4,7 @@ * */ -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/Notifications/ProgramNotifications.h" #include "CommonTools/Async/InferenceRoutines.h" #include "NintendoSwitch/Commands/NintendoSwitch_Commands_PushButtons.h" @@ -100,7 +100,7 @@ void run_entrance( // List of bosses is full, stop the program stream.log("Cannot save path – saved list is full. Stopping program.", COLOR_RED); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::NO_ERROR_REPORT, "Paths list is full. Program stopped.", stream @@ -110,7 +110,7 @@ void run_entrance( stream.log("Detected overworld."); return; default: - throw OperationFailedException( + throw OperationFailedExceptionWithScreenshot( ErrorReport::SEND_ERROR_REPORT, "No recognized state after 10 seconds.", stream diff --git a/SerialPrograms/Source/PokemonSwSh/Programs/EggPrograms/PokemonSwSh_EggAutonomous.cpp b/SerialPrograms/Source/PokemonSwSh/Programs/EggPrograms/PokemonSwSh_EggAutonomous.cpp index ff3e601205..56e3dce7ab 100644 --- a/SerialPrograms/Source/PokemonSwSh/Programs/EggPrograms/PokemonSwSh_EggAutonomous.cpp +++ b/SerialPrograms/Source/PokemonSwSh/Programs/EggPrograms/PokemonSwSh_EggAutonomous.cpp @@ -6,7 +6,8 @@ #include #include "CommonFramework/StaticGlobals.h" -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/ErrorReports/ErrorReports.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/Notifications/ProgramNotifications.h" #include "CommonFramework/ProgramStats/StatsTracking.h" #include "CommonFramework/Tools/ErrorDumper.h" @@ -210,7 +211,7 @@ void EggAutonomous::program(SingleSwitchProgramEnvironment& env, ProControllerCo size_t num_eggs_in_party = count_eggs_in_party(env.console, screen); size_t num_empty_slots_in_party = count_empty_slots_in_party(env.console, screen); if (num_eggs_in_column_0 + num_empty_slots_in_column_0 != 5){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Total number of eggs and empty slots in the first box column don't add up to 5. " "During setup, ensure there are no non-egg Pokemon in the first box column.", @@ -218,7 +219,7 @@ void EggAutonomous::program(SingleSwitchProgramEnvironment& env, ProControllerCo ); } if (num_eggs_in_party + num_empty_slots_in_party != 5){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Total number of eggs and empty slots in the party don't add up to 5. " "During setup, ensure there is only one Pokemon in the lead slot, and no other Pokemon.", @@ -275,10 +276,20 @@ void EggAutonomous::program(SingleSwitchProgramEnvironment& env, ProControllerCo // We successfully finish one egg loop iteration without any error thrown. // So we reset the failure counter. consecutive_failures = 0; - }catch (OperationFailedException& e){ + }catch (OperationFailedExceptionWithScreenshot& e){ stats.m_errors++; env.update_stats(); - e.send_notification(env, NOTIFICATION_ERROR_RECOVERABLE); + send_program_recoverable_error_notification(env, NOTIFICATION_ERROR_RECOVERABLE, e.message(), *e.screenshot()); + if (e.error_report_mode() == ErrorReport::SEND_ERROR_REPORT){ + PokemonAutomation::report_error( + &env.logger(), + env.program_info(), + "Recoverable: OperationFailedExceptionWithScreenshot", + {{"Message:", e.message()}}, + *e.screenshot(), + &e.video_stream()->history() + ); + } if (SAVE_DEBUG_VIDEO){ // Take a video to give more context for debugging @@ -293,7 +304,7 @@ void EggAutonomous::program(SingleSwitchProgramEnvironment& env, ProControllerCo consecutive_failures++; if (consecutive_failures >= 3){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Failed 3 batches in the row.", env.console @@ -501,7 +512,7 @@ bool EggAutonomous::run_bike_loop( env.console.log("Hatching detected during bike loop."); return true; }else{ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "run_bike_loop: No recognized state after 10 seconds.", env.console @@ -529,7 +540,7 @@ void EggAutonomous::exceed_bike_loop_limit( ssf_press_button(context, BUTTON_A, GameSettings::instance().MENU_TO_POKEMON_DELAY0, EGG_BUTTON_HOLD_DELAY); context.wait_for_all_requests(); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Max number of loops reached. Not enough eggs in party?", env.console @@ -553,7 +564,7 @@ size_t EggAutonomous::hatch_routine( } ); if (ret0 < 0){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "hatch_routine: We expected to see a hatching egg, but no hatching detected.", env.console @@ -639,7 +650,7 @@ void EggAutonomous::wait_for_egg_hatched( {{end_egg_hatching_detector}} ); if (ret > 0){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Cannot detect egg hatching ends.", env.console @@ -726,7 +737,7 @@ EggFetchResult EggAutonomous::talk_to_lady_to_fetch_egg( egg_status_known = true; // break the loop. then mash B continue; default: - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "talk_to_lady_to_fetch_egg(): No recognized state after 30 seconds.", env.console @@ -735,7 +746,7 @@ EggFetchResult EggAutonomous::talk_to_lady_to_fetch_egg( } if (!egg_status_known){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "talk_to_lady_to_fetch_egg(): Caught in loop. Unable to speak to lady after 2 minutes.", env.console @@ -752,7 +763,7 @@ EggFetchResult EggAutonomous::talk_to_lady_to_fetch_egg( {{overworld}} ); if (ret2 < 0){ // If dialog over is not detected: - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Cannot detect end of Nursery lady dialog. No Y-Comm mark found.", env.console @@ -794,14 +805,14 @@ bool EggAutonomous::process_hatched_pokemon( size_t num_eggs_in_party_before = count_eggs_in_party(env.console, screen0); size_t num_empty_slots_in_party_before = count_empty_slots_in_party(env.console, screen0); if (num_eggs_in_column_0_before != 5 || num_empty_slots_in_column_0_before != 0){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "process_hatched_pokemon: Before processing, we expected 5 eggs in the first box column.", env.console ); } if (num_eggs_in_party_before != 0 || num_empty_slots_in_party_before != 0){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "process_hatched_pokemon: Before processing, we expected a party without eggs (and no empty slots), since they should all be hatched.", env.console @@ -943,7 +954,7 @@ bool EggAutonomous::process_hatched_pokemon( {{pokemon_menu_detector}} ); if (ret != 0){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Cannot detect pokemon menu in storage box.", env.console @@ -972,7 +983,7 @@ bool EggAutonomous::process_hatched_pokemon( {{dialog_detector}} ); if (ret != 0){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Miss second dialog when releasing pokemon.", env.console @@ -990,7 +1001,7 @@ bool EggAutonomous::process_hatched_pokemon( pbf_press_button(context, BUTTON_A, 160ms, 800ms); } if (dialog_count == max_dialog_count){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Unexpected dialogs when releasing pokemon.", env.console @@ -1038,7 +1049,7 @@ bool EggAutonomous::process_hatched_pokemon( size_t num_eggs_in_party_after = count_eggs_in_party(env.console, screen); size_t num_empty_slots_in_party_after = count_empty_slots_in_party(env.console, screen); if (num_eggs_in_column_0_after != 0 || num_empty_slots_in_column_0_after != 5){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "process_hatched_pokemon: After processing, we expected an empty first box column.", env.console @@ -1046,7 +1057,7 @@ bool EggAutonomous::process_hatched_pokemon( } if (num_eggs_in_party_after != 5 || num_empty_slots_in_party_after != 0){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "process_hatched_pokemon: After processing, we expected a party full of 5 eggs.", env.console @@ -1071,7 +1082,7 @@ bool EggAutonomous::process_hatched_pokemon( {{y_comm_detector}} ); if (ret > 0){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Cannot detect Y-Comm after leaving menu.", env.console @@ -1101,7 +1112,7 @@ void EggAutonomous::check_box_filled(VideoStream& stream, const ImageViewRGB32& bool is_empty = slot.detect(screen); // stream.log("row " + std::to_string(row) + " col " + std::to_string(column) + (is_empty ? " is_empty" : " not empty")); if (is_empty){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "check_box_filled: Box is not filled.", stream @@ -1116,7 +1127,7 @@ void EggAutonomous::check_non_egg_lead(VideoStream& stream, const ImageViewRGB32 BoxEmptySlotDetector slot(SlotLocation::PARTY, 0, 0); bool is_empty = slot.detect(screen); if (is_empty){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "check_non_egg_lead: Detected an empty lead slot in party. This shouldn't be possible.", stream @@ -1126,7 +1137,7 @@ void EggAutonomous::check_non_egg_lead(VideoStream& stream, const ImageViewRGB32 BoxEggDetector egg(SlotLocation::PARTY, 0); bool is_egg = egg.detect(screen); if (is_egg){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "check_non_egg_lead: Detected an egg in lead slot of party.", stream diff --git a/SerialPrograms/Source/PokemonSwSh/Programs/NonShinyHunting/PokemonSwSh_StatsReset-Moltres.cpp b/SerialPrograms/Source/PokemonSwSh/Programs/NonShinyHunting/PokemonSwSh_StatsReset-Moltres.cpp index 52a6af2683..e8c0777ece 100644 --- a/SerialPrograms/Source/PokemonSwSh/Programs/NonShinyHunting/PokemonSwSh_StatsReset-Moltres.cpp +++ b/SerialPrograms/Source/PokemonSwSh/Programs/NonShinyHunting/PokemonSwSh_StatsReset-Moltres.cpp @@ -4,7 +4,7 @@ * */ -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/Notifications/ProgramNotifications.h" #include "CommonFramework/ProgramStats/StatsTracking.h" #include "CommonFramework/VideoPipeline/VideoFeed.h" @@ -135,7 +135,7 @@ void StatsResetMoltres::program(SingleSwitchProgramEnvironment& env, ProControll context.wait_for_all_requests(); CatchResults result = basic_catcher(env.console, context, LANGUAGE, "master-ball", 999); if (result.result != CatchResult::POKEMON_CAUGHT){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Unable to catch Moltres.", env.console diff --git a/SerialPrograms/Source/PokemonSwSh/Programs/PokemonSwSh_BoxHelpers.cpp b/SerialPrograms/Source/PokemonSwSh/Programs/PokemonSwSh_BoxHelpers.cpp index a0321a629d..d56805c7e5 100644 --- a/SerialPrograms/Source/PokemonSwSh/Programs/PokemonSwSh_BoxHelpers.cpp +++ b/SerialPrograms/Source/PokemonSwSh/Programs/PokemonSwSh_BoxHelpers.cpp @@ -5,7 +5,7 @@ */ #include "CommonFramework/Tools/VideoStream.h" -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/ImageTools/ImageStats.h" #include "CommonFramework/VideoPipeline/VideoFeed.h" #include "CommonFramework/VideoPipeline/VideoOverlayScopes.h" @@ -28,7 +28,7 @@ bool change_view_to_stats_or_judge( for (size_t attempts = 0;; attempts++){ if (throw_exception){ if (attempts == 10){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Unable to change Pokemon view after 10 tries.", stream @@ -79,7 +79,7 @@ void change_view_to_judge( OverlayBoxScope name_bar_overlay(stream.overlay(), name_bar); for (size_t attempts = 0;; attempts++){ if (attempts == 10){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Unable to change Pokemon view to judge after 10 tries. Have you unlocked it?", stream diff --git a/SerialPrograms/Source/PokemonSwSh/Programs/PokemonSwSh_EncounterHandler.cpp b/SerialPrograms/Source/PokemonSwSh/Programs/PokemonSwSh_EncounterHandler.cpp index 0f054a75c3..a7e22b0339 100644 --- a/SerialPrograms/Source/PokemonSwSh/Programs/PokemonSwSh_EncounterHandler.cpp +++ b/SerialPrograms/Source/PokemonSwSh/Programs/PokemonSwSh_EncounterHandler.cpp @@ -4,7 +4,7 @@ * */ -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/Exceptions/FatalProgramException.h" #include "CommonFramework/Tools/ProgramEnvironment.h" #include "CommonTools/Async/InferenceRoutines.h" @@ -63,7 +63,7 @@ void run_away( context->logger().log("Unable to detect end of battle. Assume successful run away.", COLOR_ORANGE); return; #if 0 - throw OperationFailedException( + throw OperationFailedExceptionWithScreenshot( ErrorReport::SEND_ERROR_REPORT, "Unable to run away. Are you stuck in the battle?", stream @@ -133,7 +133,7 @@ bool StandardEncounterHandler::handle_standard_encounter(const ShinyDetectionRes m_session_stats.add_error(); m_consecutive_failures++; if (m_consecutive_failures >= 3){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "3 consecutive failed encounter detections.", m_stream @@ -189,7 +189,7 @@ bool StandardEncounterHandler::handle_standard_encounter_end_battle( m_session_stats.add_error(); m_consecutive_failures++; if (m_consecutive_failures >= 3){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "3 consecutive failed encounter detections.", m_stream diff --git a/SerialPrograms/Source/PokemonSwSh/Programs/PokemonSwSh_MenuNavigation.cpp b/SerialPrograms/Source/PokemonSwSh/Programs/PokemonSwSh_MenuNavigation.cpp index 142ad7a049..1aed56a874 100644 --- a/SerialPrograms/Source/PokemonSwSh/Programs/PokemonSwSh_MenuNavigation.cpp +++ b/SerialPrograms/Source/PokemonSwSh/Programs/PokemonSwSh_MenuNavigation.cpp @@ -5,7 +5,7 @@ */ -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/Tools/ErrorDumper.h" //#include "CommonFramework/VideoPipeline/VideoFeed.h" #include "CommonTools/Async/InferenceRoutines.h" @@ -35,7 +35,7 @@ void navigate_to_menu_app( ); const int cur_app_index = menu_arrow.current_index(); if (cur_app_index < 0){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Cannot detect Rotom phone menu.", stream @@ -108,7 +108,7 @@ void menus_to_mainmenu(VideoStream& stream, ProControllerContext& context){ } }while (current_time() < deadline); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Unable to reach Main Menu after 2 minutes.", stream @@ -157,7 +157,7 @@ void menus_to_boxsystem(VideoStream& stream, ProControllerContext& context){ } }while (current_time() < deadline); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Unable to reach Box System after 2 minutes.", stream @@ -212,7 +212,7 @@ void save_game(VideoStream& stream, ProControllerContext& context){ } }while (current_time() < deadline); - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Unable to save game after 2 minutes.", stream @@ -236,7 +236,7 @@ void mash_B_until_y_comm_icon( {y_comm_detector} ); if (ret != 0){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, error_msg + " No Y-Comm mark found.", stream diff --git a/SerialPrograms/Source/PokemonSwSh/Programs/QoLMacros/PokemonSwSh_FriendSearchDisconnect.cpp b/SerialPrograms/Source/PokemonSwSh/Programs/QoLMacros/PokemonSwSh_FriendSearchDisconnect.cpp index 08c1c4158c..5519eaebad 100644 --- a/SerialPrograms/Source/PokemonSwSh/Programs/QoLMacros/PokemonSwSh_FriendSearchDisconnect.cpp +++ b/SerialPrograms/Source/PokemonSwSh/Programs/QoLMacros/PokemonSwSh_FriendSearchDisconnect.cpp @@ -4,7 +4,7 @@ * */ -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/VideoPipeline/VideoFeed.h" #include "CommonTools/Async/InferenceRoutines.h" #include "NintendoSwitch/Commands/NintendoSwitch_Commands_PushButtons.h" @@ -63,7 +63,7 @@ void FriendSearchDisconnect::program(SingleSwitchProgramEnvironment& env, ProCon {home_menu} ); if (ret < 0){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Home menu not detected after 5 seconds.", env.console diff --git a/SerialPrograms/Source/PokemonSwSh/Programs/RNG/PokemonSwSh_BasicRNG.cpp b/SerialPrograms/Source/PokemonSwSh/Programs/RNG/PokemonSwSh_BasicRNG.cpp index 0099a41987..2ca64cf2b1 100644 --- a/SerialPrograms/Source/PokemonSwSh/Programs/RNG/PokemonSwSh_BasicRNG.cpp +++ b/SerialPrograms/Source/PokemonSwSh/Programs/RNG/PokemonSwSh_BasicRNG.cpp @@ -6,7 +6,7 @@ #include #include "Common/Cpp/PrettyPrint.h" -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "NintendoSwitch/Commands/NintendoSwitch_Commands_PushButtons.h" #include "PokemonSwSh/Inference/RNG/PokemonSwSh_OrbeetleAttackAnimationDetector.h" #include "PokemonSwSh/Programs/RNG/PokemonSwSh_BasicRNG.h" @@ -33,7 +33,7 @@ Xoroshiro128PlusState find_rng_state( uint64_t last_bit = 0; switch (detection){ case OrbeetleAttackAnimationDetector::NO_DETECTION: - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Attack animation could not be detected.", stream @@ -106,7 +106,7 @@ std::pair refind_rng_state_and_animations( OrbeetleAttackAnimationDetector::Detection detection = detector.run(save_screenshots, log_image_values); switch (detection){ case OrbeetleAttackAnimationDetector::NO_DETECTION: - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Attack animation could not be detected.", stream @@ -135,7 +135,7 @@ std::pair refind_rng_state_and_animations( } } if (possible_indices == 0){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Detected sequence of attack motions does not exist in expected range.", stream diff --git a/SerialPrograms/Source/PokemonSwSh/Programs/RNG/PokemonSwSh_CramomaticRNG.cpp b/SerialPrograms/Source/PokemonSwSh/Programs/RNG/PokemonSwSh_CramomaticRNG.cpp index 7f4bb7f9e8..40918ac80e 100644 --- a/SerialPrograms/Source/PokemonSwSh/Programs/RNG/PokemonSwSh_CramomaticRNG.cpp +++ b/SerialPrograms/Source/PokemonSwSh/Programs/RNG/PokemonSwSh_CramomaticRNG.cpp @@ -11,7 +11,7 @@ #include #include #include "CommonFramework/Exceptions/ProgramFinishedException.h" -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/Notifications/ProgramNotifications.h" #include "CommonFramework/ProgramStats/StatsTracking.h" #include "CommonFramework/ImageTools/ImageStats.h" @@ -316,7 +316,7 @@ void CramomaticRNG::choose_apricorn(SingleSwitchProgramEnvironment& env, ProCont int ret = wait_until(env.console, context, Milliseconds(5000), { bag_arrow_detector }); if (ret < 0){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Could not detect bag.", env.console @@ -488,7 +488,7 @@ void CramomaticRNG::program(SingleSwitchProgramEnvironment& env, ProControllerCo state_errors++; if (state_errors >= 3){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Detected invalid RNG state three times in a row.", env.console @@ -518,13 +518,13 @@ void CramomaticRNG::program(SingleSwitchProgramEnvironment& env, ProControllerCo try{ choose_apricorn(env, context, sport); - }catch (OperationFailedException& e){ + }catch (OperationFailedExceptionWithScreenshot& e){ stats.errors++; env.update_stats(); apricorn_selection_errors++; if (apricorn_selection_errors >= 3){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Could not detect the bag three times on a row.", env.console @@ -534,7 +534,7 @@ void CramomaticRNG::program(SingleSwitchProgramEnvironment& env, ProControllerCo env, NOTIFICATION_ERROR_RECOVERABLE, e.message(), - e.screenshot_view() + *e.screenshot() ); is_state_valid = false; recover_from_wrong_state(env, context); diff --git a/SerialPrograms/Source/PokemonSwSh/Programs/RNG/PokemonSwSh_DailyHighlightRNG.cpp b/SerialPrograms/Source/PokemonSwSh/Programs/RNG/PokemonSwSh_DailyHighlightRNG.cpp index d31d952f33..355a8f5076 100644 --- a/SerialPrograms/Source/PokemonSwSh/Programs/RNG/PokemonSwSh_DailyHighlightRNG.cpp +++ b/SerialPrograms/Source/PokemonSwSh/Programs/RNG/PokemonSwSh_DailyHighlightRNG.cpp @@ -7,7 +7,7 @@ */ #include "CommonFramework/Exceptions/ProgramFinishedException.h" -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/Notifications/ProgramNotifications.h" #include "CommonFramework/ProgramStats/StatsTracking.h" #include "CommonFramework/VideoPipeline/VideoFeed.h" @@ -193,7 +193,7 @@ void DailyHighlightRNG::interact_with_trader(SingleSwitchProgramEnvironment& env if (tries >= 10){ DailyHighlightRNG_Descriptor::Stats& stats = env.current_stats(); stats.errors++; - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Failed to talk to the trader.", env.console @@ -232,7 +232,7 @@ void DailyHighlightRNG::buy_highlight(SingleSwitchProgramEnvironment& env, ProCo if (ret < 0){ DailyHighlightRNG_Descriptor::Stats& stats = env.current_stats(); stats.errors++; - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Could not detect dialog.", env.console @@ -327,7 +327,7 @@ uint8_t DailyHighlightRNG::calibrate_num_npc_from_party(SingleSwitchProgramEnvir } } - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "NPC is in the wrong state or an unexpected number of NPCs is in the area.", env.console @@ -400,7 +400,7 @@ void DailyHighlightRNG::return_to_overworld(SingleSwitchProgramEnvironment& env, if (ret != 0){ DailyHighlightRNG_Descriptor::Stats& stats = env.current_stats(); stats.errors++; - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Cannot detect the Y-Comm icon.", env.console @@ -518,7 +518,7 @@ void DailyHighlightRNG::program(SingleSwitchProgramEnvironment& env, ProControll state_errors++; if (state_errors >= 3){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, "Detected invalid RNG state three times in a row.", env.console @@ -535,12 +535,12 @@ void DailyHighlightRNG::program(SingleSwitchProgramEnvironment& env, ProControll try{ num_npcs = calibrate_num_npc_from_party(env, context, rng); } - catch (OperationFailedException& exception){ + catch (OperationFailedExceptionWithScreenshot& exception){ send_program_recoverable_error_notification( env, NOTIFICATION_ERROR_RECOVERABLE, exception.message(), - exception.screenshot_view() + *exception.screenshot() ); assumed_successful_iterations = 0; stats.errors++; From 152fcbac42143bd2a58259b572152d7a3bf645f8 Mon Sep 17 00:00:00 2001 From: jw098 Date: Wed, 26 Aug 2026 22:40:28 -0700 Subject: [PATCH 05/15] replace usage of ScreenshotException with OperationFailedExceptionWithScreenshot --- CodingAgentContext/AutomationProgramPatterns.md | 2 +- .../Framework/NintendoSwitch_SingleSwitchProgramSession.cpp | 1 + .../ML/PokemonLA_GeneratePokemonImageTrainingData.cpp | 3 +-- .../Programs/Farming/PokemonLZA_FriendshipFarmer.cpp | 1 - .../PokemonSV/Programs/Eggs/PokemonSV_EggAutonomous.cpp | 6 +++--- .../PokemonSV/Programs/Eggs/PokemonSV_EggAutonomous.h | 3 +-- 6 files changed, 7 insertions(+), 9 deletions(-) diff --git a/CodingAgentContext/AutomationProgramPatterns.md b/CodingAgentContext/AutomationProgramPatterns.md index e117df6a9d..fee4a67712 100644 --- a/CodingAgentContext/AutomationProgramPatterns.md +++ b/CodingAgentContext/AutomationProgramPatterns.md @@ -118,7 +118,7 @@ while(true){ env.update_stats(); send_program_finished_notification(env, NOTIFICATION_PROGRAM_FINISH); throw; - }catch(ScreenshotException& e){ // an exception indicating an error somewhere in the loop + }catch(OperationFailedException& e){ // an exception indicating an error somewhere in the loop if(...){ // if we can recover from it // execute recover logic (usually is restarting the game) continue; diff --git a/SerialPrograms/Source/NintendoSwitch/Framework/NintendoSwitch_SingleSwitchProgramSession.cpp b/SerialPrograms/Source/NintendoSwitch/Framework/NintendoSwitch_SingleSwitchProgramSession.cpp index a25be43ea4..2c6cdff66d 100644 --- a/SerialPrograms/Source/NintendoSwitch/Framework/NintendoSwitch_SingleSwitchProgramSession.cpp +++ b/SerialPrograms/Source/NintendoSwitch/Framework/NintendoSwitch_SingleSwitchProgramSession.cpp @@ -9,6 +9,7 @@ #include "Common/Cpp/Concurrency/SpinPause.h" #include "CommonFramework/ErrorReports/ErrorReports.h" #include "CommonFramework/GlobalSettingsPanel.h" +#include "CommonFramework/Exceptions/FatalProgramException.h" #include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/Exceptions/ProgramFinishedException.h" #include "CommonFramework/Options/Environment/SleepSuppressOption.h" diff --git a/SerialPrograms/Source/PokemonLA/Programs/ML/PokemonLA_GeneratePokemonImageTrainingData.cpp b/SerialPrograms/Source/PokemonLA/Programs/ML/PokemonLA_GeneratePokemonImageTrainingData.cpp index 3bb4be538f..cabd112c21 100644 --- a/SerialPrograms/Source/PokemonLA/Programs/ML/PokemonLA_GeneratePokemonImageTrainingData.cpp +++ b/SerialPrograms/Source/PokemonLA/Programs/ML/PokemonLA_GeneratePokemonImageTrainingData.cpp @@ -7,7 +7,6 @@ #include "Common/Cpp/Exceptions.h" #include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/Exceptions/ProgramFinishedException.h" -#include "CommonFramework/Exceptions/ScreenshotException.h" #include "CommonFramework/ImageTools/ImageStats.h" #include "CommonFramework/Notifications/ProgramNotifications.h" #include "CommonFramework/VideoPipeline/VideoFeed.h" @@ -127,7 +126,7 @@ void GeneratePokemonImageTrainingData::program(SingleSwitchProgramEnvironment& e // Program was stopped by user send_program_finished_notification(env, NOTIFICATION_PROGRAM_FINISH); throw; - }catch (ScreenshotException& e){ + }catch (OperationFailedExceptionWithScreenshot& e){ std::string fail_message = e.message(); OperationFailedExceptionWithScreenshot::fire( ErrorReport::SEND_ERROR_REPORT, diff --git a/SerialPrograms/Source/PokemonLZA/Programs/Farming/PokemonLZA_FriendshipFarmer.cpp b/SerialPrograms/Source/PokemonLZA/Programs/Farming/PokemonLZA_FriendshipFarmer.cpp index 87272bb847..158d5d2325 100644 --- a/SerialPrograms/Source/PokemonLZA/Programs/Farming/PokemonLZA_FriendshipFarmer.cpp +++ b/SerialPrograms/Source/PokemonLZA/Programs/Farming/PokemonLZA_FriendshipFarmer.cpp @@ -7,7 +7,6 @@ #include "PokemonLZA_FriendshipFarmer.h" #include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" -#include "CommonFramework/Exceptions/ScreenshotException.h" #include "CommonFramework/Notifications/ProgramNotifications.h" #include "CommonFramework/ProgramStats/StatsTracking.h" #include "CommonTools/Async/InferenceRoutines.h" diff --git a/SerialPrograms/Source/PokemonSV/Programs/Eggs/PokemonSV_EggAutonomous.cpp b/SerialPrograms/Source/PokemonSV/Programs/Eggs/PokemonSV_EggAutonomous.cpp index 5e95ffde6a..0b10238bb9 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/Eggs/PokemonSV_EggAutonomous.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/Eggs/PokemonSV_EggAutonomous.cpp @@ -264,7 +264,7 @@ void EggAutonomous::program(SingleSwitchProgramEnvironment& env, ProControllerCo try{ num_party_eggs = fetch_eggs_full_routine(env, context); break; - }catch (ScreenshotException& e){ + }catch (OperationFailedException& e){ if (handle_recoverable_error( env, context, NOTIFICATION_ERROR_RECOVERABLE, @@ -288,7 +288,7 @@ void EggAutonomous::program(SingleSwitchProgramEnvironment& env, ProControllerCo GO_HOME_WHEN_DONE.run_end_of_program(context); send_program_finished_notification(env, NOTIFICATION_PROGRAM_FINISH); return; - }catch (ScreenshotException& e){ + }catch (OperationFailedException& e){ if (handle_recoverable_error( env, context, NOTIFICATION_ERROR_RECOVERABLE, @@ -806,7 +806,7 @@ void change_settings_egg_program(SingleSwitchProgramEnvironment& env, ProControl bool EggAutonomous::handle_recoverable_error( SingleSwitchProgramEnvironment& env, ProControllerContext& context, EventNotificationOption& notification, - const ScreenshotException& e, + const OperationFailedException& e, size_t& consecutive_failures ){ auto& stats = env.current_stats(); diff --git a/SerialPrograms/Source/PokemonSV/Programs/Eggs/PokemonSV_EggAutonomous.h b/SerialPrograms/Source/PokemonSV/Programs/Eggs/PokemonSV_EggAutonomous.h index ad3cc8b17c..86aea11d61 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/Eggs/PokemonSV_EggAutonomous.h +++ b/SerialPrograms/Source/PokemonSV/Programs/Eggs/PokemonSV_EggAutonomous.h @@ -21,7 +21,6 @@ namespace PokemonAutomation{ -class ScreenshotException; class OperationFailedException; namespace NintendoSwitch{ @@ -65,7 +64,7 @@ class EggAutonomous : public SingleSwitchProgramInstance{ bool handle_recoverable_error( SingleSwitchProgramEnvironment& env, ProControllerContext& context, EventNotificationOption& notification, - const ScreenshotException& e, + const OperationFailedException& e, size_t& consecutive_failures ); From c840ed11497448fb45f44fd97a257a0e9ab51168 Mon Sep 17 00:00:00 2001 From: jw098 Date: Wed, 26 Aug 2026 23:38:52 -0700 Subject: [PATCH 06/15] remove ScreenshotException --- .../Exceptions/FatalProgramException.h | 75 +++++++-- ...OperationFailedExceptionWithScreenshot.cpp | 11 -- .../Exceptions/ProgramFinishedException.cpp | 29 +++- .../Exceptions/ProgramFinishedException.h | 17 ++- .../Exceptions/ScreenshotException.cpp | 142 ------------------ .../Exceptions/ScreenshotException.h | 88 ----------- .../Framework/ComputerProgramSession.cpp | 21 ++- ...ntendoSwitch_MultiSwitchProgramSession.cpp | 20 ++- ...tendoSwitch_SingleSwitchProgramSession.cpp | 18 ++- SerialPrograms/cmake/SourceFiles.cmake | 2 - 10 files changed, 152 insertions(+), 271 deletions(-) delete mode 100644 SerialPrograms/Source/CommonFramework/Exceptions/ScreenshotException.cpp delete mode 100644 SerialPrograms/Source/CommonFramework/Exceptions/ScreenshotException.h diff --git a/SerialPrograms/Source/CommonFramework/Exceptions/FatalProgramException.h b/SerialPrograms/Source/CommonFramework/Exceptions/FatalProgramException.h index 9a9a65a77d..ae69b335a4 100644 --- a/SerialPrograms/Source/CommonFramework/Exceptions/FatalProgramException.h +++ b/SerialPrograms/Source/CommonFramework/Exceptions/FatalProgramException.h @@ -7,25 +7,80 @@ #ifndef PokemonAutomation_FatalProgramException_H #define PokemonAutomation_FatalProgramException_H -#include "ScreenshotException.h" +#include "Common/Cpp/Exceptions.h" +#include "CommonFramework/VideoPipeline/VideoFeed.h" +#include "CommonFramework/Tools/VideoStream.h" namespace PokemonAutomation{ // A generic exception that should not be caught outside of infra. -class FatalProgramException : public ScreenshotException{ +class FatalProgramException : public Exception{ public: - using ScreenshotException::ScreenshotException; - FatalProgramException(ScreenshotException&& e) - : ScreenshotException( - e.m_send_error_report, - std::move(e.m_message), - e.m_stream, - std::move(e.m_screenshot) - ) + + explicit FatalProgramException( + ErrorReport error_report, + std::string message + ) + : m_error_report_mode(error_report) + , m_message(message) + {} + + explicit FatalProgramException( + ErrorReport error_report, + std::string message, + VideoStream& stream + ) + : m_error_report_mode(error_report) + , m_message(message) + , m_stream(&stream) + , m_screenshot(stream.video().snapshot().frame) + {} + + // Construct exception with message with screenshot and (optionally) console information. + // Use the provided screenshot instead of taking one with the console. + // Store the console information (if provided) for stream history if requested later. + explicit FatalProgramException( + ErrorReport error_report, + std::string message, + VideoStream* stream, + ImageRGB32 screenshot + ) + : m_error_report_mode(error_report) + , m_message(message) + , m_stream(stream) + , m_screenshot(std::make_shared(std::move(screenshot))) + {} + + explicit FatalProgramException( + ErrorReport error_report, + std::string message, + VideoStream* stream, + std::shared_ptr screenshot + ) + : m_error_report_mode(error_report) + , m_message(message) + , m_stream(stream) + , m_screenshot(std::move(screenshot)) {} + ErrorReport error_report_mode() const { return m_error_report_mode; }; virtual const char* name() const override{ return "FatalProgramException"; } + ImageViewRGB32 screenshot_view() const { + if (m_screenshot){ + return *m_screenshot; + }else{ + return ImageViewRGB32(); + } + } + std::shared_ptr screenshot() const {return m_screenshot;} + VideoStream* video_stream() const{return m_stream;}; + +private: + ErrorReport m_error_report_mode; + std::string m_message; + VideoStream* m_stream = nullptr; + std::shared_ptr m_screenshot; }; diff --git a/SerialPrograms/Source/CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.cpp b/SerialPrograms/Source/CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.cpp index bff0fa553f..523c3d821b 100644 --- a/SerialPrograms/Source/CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.cpp +++ b/SerialPrograms/Source/CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.cpp @@ -55,17 +55,6 @@ OperationFailedExceptionWithScreenshot::OperationFailedExceptionWithScreenshot( {} -// void ScreenshotException::add_stream_if_needed(VideoStream& stream){ -// if (m_stream == nullptr){ -// m_stream = &stream; -// } -// if (!m_screenshot){ -// m_screenshot = stream.video().snapshot(); -// if (m_screenshot == nullptr || !*m_screenshot){ -// stream.log("Camera returned empty screenshot. Is the camera frozen?", COLOR_RED); -// } -// } -// } ImageViewRGB32 OperationFailedExceptionWithScreenshot::screenshot_view() const{ if (m_screenshot){ diff --git a/SerialPrograms/Source/CommonFramework/Exceptions/ProgramFinishedException.cpp b/SerialPrograms/Source/CommonFramework/Exceptions/ProgramFinishedException.cpp index e0396fc636..5e5ea7ad02 100644 --- a/SerialPrograms/Source/CommonFramework/Exceptions/ProgramFinishedException.cpp +++ b/SerialPrograms/Source/CommonFramework/Exceptions/ProgramFinishedException.cpp @@ -13,7 +13,7 @@ namespace PokemonAutomation{ ProgramFinishedException::ProgramFinishedException(){} ProgramFinishedException::ProgramFinishedException(std::string message) - : ScreenshotException(ErrorReport::NO_ERROR_REPORT, std::move(message)) + : m_message(message) {} @@ -21,7 +21,9 @@ ProgramFinishedException::ProgramFinishedException( std::string message, VideoStream& stream ) - : ScreenshotException(ErrorReport::NO_ERROR_REPORT, std::move(message), stream) + : m_message(message) + , m_stream(&stream) + , m_screenshot(stream.video().snapshot().frame) {} ProgramFinishedException::ProgramFinishedException( ErrorReport error_report, @@ -29,20 +31,39 @@ ProgramFinishedException::ProgramFinishedException( VideoStream* stream, ImageRGB32 screenshot ) - : ScreenshotException(ErrorReport::NO_ERROR_REPORT, std::move(message), stream, std::move(screenshot)) + : m_message(message) + , m_stream(stream) + , m_screenshot(std::make_shared(std::move(screenshot))) {} ProgramFinishedException::ProgramFinishedException( std::string message, VideoStream* stream, std::shared_ptr screenshot ) - : ScreenshotException(ErrorReport::NO_ERROR_REPORT, std::move(message), stream, std::move(screenshot)) + : m_message(message) + , m_stream(stream) + , m_screenshot(std::move(screenshot)) {} void ProgramFinishedException::log(Logger& logger) const{ logger.log(std::string(name()) + ": " + message(), COLOR_BLUE); } +ImageViewRGB32 ProgramFinishedException::screenshot_view() const{ + if (m_screenshot){ + return *m_screenshot; + }else{ + return ImageViewRGB32(); + } +} +std::shared_ptr ProgramFinishedException::screenshot() const{ + return m_screenshot; +} + +VideoStream* ProgramFinishedException::video_stream() const{ + return m_stream; +} + diff --git a/SerialPrograms/Source/CommonFramework/Exceptions/ProgramFinishedException.h b/SerialPrograms/Source/CommonFramework/Exceptions/ProgramFinishedException.h index 45dd5fe942..c358a3bcd7 100644 --- a/SerialPrograms/Source/CommonFramework/Exceptions/ProgramFinishedException.h +++ b/SerialPrograms/Source/CommonFramework/Exceptions/ProgramFinishedException.h @@ -8,7 +8,9 @@ #define PokemonAutomation_ProgramFinishedException_H #include -#include "ScreenshotException.h" +#include "Common/Cpp/Exceptions.h" +#include "CommonFramework/VideoPipeline/VideoFeed.h" +#include "CommonFramework/Tools/VideoStream.h" namespace PokemonAutomation{ @@ -23,7 +25,7 @@ class ProgramEnvironment; // Thrown when the program requests a normal stop to the program. // - This should not be consumed except by the infra. // - Non-infra are allowed to catch and rethrow this exception. -class ProgramFinishedException : public ScreenshotException{ +class ProgramFinishedException : public Exception{ public: ProgramFinishedException(); explicit ProgramFinishedException(std::string message); @@ -50,11 +52,20 @@ class ProgramFinishedException : public ScreenshotException{ std::shared_ptr screenshot ); - virtual Color color() const override{ return COLOR_GREEN; } + Color color() const{ return COLOR_GREEN; } public: virtual void log(Logger& logger) const override; virtual const char* name() const override{ return "ProgramFinishedException"; } + ImageViewRGB32 screenshot_view() const; + std::shared_ptr screenshot() const; + VideoStream* video_stream() const; + + +private: + std::string m_message; + VideoStream* m_stream = nullptr; + std::shared_ptr m_screenshot; }; diff --git a/SerialPrograms/Source/CommonFramework/Exceptions/ScreenshotException.cpp b/SerialPrograms/Source/CommonFramework/Exceptions/ScreenshotException.cpp deleted file mode 100644 index 35bf7bd6b9..0000000000 --- a/SerialPrograms/Source/CommonFramework/Exceptions/ScreenshotException.cpp +++ /dev/null @@ -1,142 +0,0 @@ -/* Screenshot Exception - * - * From: https://github.com/PokemonAutomation/ - * - */ - -#include "CommonFramework/ImageTypes/ImageRGB32.h" -#include "CommonFramework/ErrorReports/ErrorReports.h" -#include "CommonFramework/Notifications/ProgramNotifications.h" -#include "CommonFramework/VideoPipeline/VideoFeed.h" -#include "CommonFramework/Tools/VideoStream.h" -#include "CommonFramework/Tools/ProgramEnvironment.h" -#include "ScreenshotException.h" - -//#include -//using std::cout; -//using std::endl; - -namespace PokemonAutomation{ - - -ScreenshotException::ScreenshotException(ErrorReport error_report, std::string message) - : m_send_error_report(error_report) - , m_message(std::move(message)) -{} -ScreenshotException::ScreenshotException( - ErrorReport error_report, - std::string message, - VideoStream& stream -) - : m_send_error_report(error_report) - , m_message(std::move(message)) - , m_stream(&stream) - , m_screenshot(stream.video().snapshot().frame) -{ - if (m_screenshot == nullptr || !*m_screenshot){ - stream.log("Camera returned empty screenshot. Is the camera frozen?", COLOR_RED); - } -} -ScreenshotException::ScreenshotException( - ErrorReport error_report, - std::string message, - VideoStream* stream, - ImageRGB32 screenshot -) - : m_send_error_report(error_report) - , m_message(std::move(message)) - , m_stream(stream) - , m_screenshot(std::make_shared(std::move(screenshot))) -{} -ScreenshotException::ScreenshotException( - ErrorReport error_report, - std::string message, - VideoStream* stream, - std::shared_ptr screenshot -) - : m_send_error_report(error_report) - , m_message(std::move(message)) - , m_stream(stream) - , m_screenshot(std::move(screenshot)) -{} - - -void ScreenshotException::add_stream_if_needed(VideoStream& stream){ - if (m_stream == nullptr){ - m_stream = &stream; - } - if (!m_screenshot){ - m_screenshot = stream.video().snapshot(); - if (m_screenshot == nullptr || !*m_screenshot){ - stream.log("Camera returned empty screenshot. Is the camera frozen?", COLOR_RED); - } - } -} - -ImageViewRGB32 ScreenshotException::screenshot_view() const{ - if (m_screenshot){ - return *m_screenshot; - }else{ - return ImageViewRGB32(); - } -} -std::shared_ptr ScreenshotException::screenshot() const{ - return m_screenshot; -} - - -void ScreenshotException::send_notification(ProgramEnvironment& env, EventNotificationOption& notification, const std::string& title_prefix) const{ - std::vector> embeds; - if (!m_message.empty()){ - embeds.emplace_back(std::pair("Message:", m_message)); - } - - std::string title = title_prefix; - title.append(name()); - - if (m_send_error_report == ErrorReport::SEND_ERROR_REPORT){ - report_error( - &env.logger(), - env.program_info(), - title, - embeds, - screenshot_view(), - m_stream ? &m_stream->history() : nullptr - ); - } - - send_program_notification( - env, notification, - color(), - title, - std::move(embeds), "", - screenshot_view() - ); -} - -void ScreenshotException::send_recoverable_notification(ProgramEnvironment& env) const{ - EventNotificationOption recoverable_notification = EventNotificationOption( - "Program Error (Recoverable)", - true, true, - ImageAttachmentMode::JPG, - {"Notifs"} - ); - - send_notification(env, recoverable_notification, "Recoverable: "); -} - -void ScreenshotException::send_fatal_notification(ProgramEnvironment& env) const{ - EventNotificationOption fatal_notification = EventNotificationOption( - "Program Error (Fatal)", - true, true, - ImageAttachmentMode::JPG, - {"Notifs"} - ); - - send_notification(env, fatal_notification, "Fatal: "); -} - - - - -} diff --git a/SerialPrograms/Source/CommonFramework/Exceptions/ScreenshotException.h b/SerialPrograms/Source/CommonFramework/Exceptions/ScreenshotException.h deleted file mode 100644 index 26a5f1290d..0000000000 --- a/SerialPrograms/Source/CommonFramework/Exceptions/ScreenshotException.h +++ /dev/null @@ -1,88 +0,0 @@ -/* Screenshot Exception - * - * From: https://github.com/PokemonAutomation/ - * - */ - -#ifndef PokemonAutomation_ScreenshotException_H -#define PokemonAutomation_ScreenshotException_H - -#include -#include "Common/Cpp/Exceptions.h" - -namespace PokemonAutomation{ - -class ImageViewRGB32; -class ImageRGB32; -class EventNotificationOption; -class VideoStream; -struct ProgramInfo; -class ProgramEnvironment; - - - - -// Base class for program exception holding a screenshot. -// -// Do not use this class directly. It is just to reuse the screenshot holding -// logic that's shared by multiple exception types. -class ScreenshotException : public Exception{ -public: - ScreenshotException() = default; - - // Construct exception with a simple message. - explicit ScreenshotException(ErrorReport error_report, std::string message); - - // Construct exception with message and console information. - // This will take a screenshot and store the console if the stream history if requested later. - explicit ScreenshotException( - ErrorReport error_report, - std::string message, - VideoStream& stream - ); - - // Construct exception with message with screenshot and (optionally) console information. - // Use the provided screenshot instead of taking one with the console. - // Store the console information (if provided) for stream history if requested later. - explicit ScreenshotException( - ErrorReport error_report, - std::string message, - VideoStream* stream, - ImageRGB32 screenshot - ); - explicit ScreenshotException( - ErrorReport error_report, - std::string message, - VideoStream* stream, - std::shared_ptr screenshot - ); - - // Add console information if it isn't already requested. - // This will provide screenshot and stream history if requested later. - void add_stream_if_needed(VideoStream& stream); - - -public: -// virtual const char* name() const override{ return "ScreenshotException"; } - virtual std::string message() const override{ return m_message; } - ImageViewRGB32 screenshot_view() const; - std::shared_ptr screenshot() const; - - virtual Color color() const{ return COLOR_RED; } - virtual void send_notification(ProgramEnvironment& env, EventNotificationOption& notification, const std::string& title_prefix = "") const; - void send_recoverable_notification(ProgramEnvironment& env) const; - void send_fatal_notification(ProgramEnvironment& env) const; - -public: - ErrorReport m_send_error_report; - std::string m_message; - VideoStream* m_stream = nullptr; - std::shared_ptr m_screenshot; -}; - - - - - -} -#endif diff --git a/SerialPrograms/Source/ComputerPrograms/Framework/ComputerProgramSession.cpp b/SerialPrograms/Source/ComputerPrograms/Framework/ComputerProgramSession.cpp index 283875e0e6..fbe3eac5a1 100644 --- a/SerialPrograms/Source/ComputerPrograms/Framework/ComputerProgramSession.cpp +++ b/SerialPrograms/Source/ComputerPrograms/Framework/ComputerProgramSession.cpp @@ -7,6 +7,7 @@ #include "Common/Cpp/Exceptions.h" #include "Common/Cpp/CancellableScope.h" #include "CommonFramework/ErrorReports/ErrorReports.h" +#include "CommonFramework/Exceptions/FatalProgramException.h" #include "CommonFramework/Exceptions/ProgramFinishedException.h" #include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/Notifications/ProgramInfo.h" @@ -119,7 +120,7 @@ void ComputerProgramSession::internal_run_program(){ }catch (ProgramCancelledException&){ }catch (ProgramFinishedException& e){ logger().log("Program finished early!", COLOR_BLUE); - e.send_notification(env, m_option.instance().NOTIFICATION_PROGRAM_FINISH); + send_program_finished_notification(env, m_option.instance().NOTIFICATION_PROGRAM_FINISH, e.message(), *e.screenshot()); }catch (InvalidConnectionStateException&){ }catch (OperationFailedExceptionWithScreenshot& e){ logger().log("Program stopped with an exception!", COLOR_RED); @@ -139,6 +140,24 @@ void ComputerProgramSession::internal_run_program(){ &e.video_stream()->history() ); } + }catch (FatalProgramException& e){ + logger().log("Program stopped with an exception!", COLOR_RED); + std::string message = e.message(); + if (message.empty()){ + message = e.name(); + } + report_error(message); + 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(), + "Recoverable: OperationFailedExceptionWithScreenshot", + {{"Message:", e.message()}}, + *e.screenshot(), + &e.video_stream()->history() + ); + } }catch (Exception& e){ logger().log("Program stopped with an exception!", COLOR_RED); std::string message = e.message(); diff --git a/SerialPrograms/Source/NintendoSwitch/Framework/NintendoSwitch_MultiSwitchProgramSession.cpp b/SerialPrograms/Source/NintendoSwitch/Framework/NintendoSwitch_MultiSwitchProgramSession.cpp index c170e43338..65e227c448 100644 --- a/SerialPrograms/Source/NintendoSwitch/Framework/NintendoSwitch_MultiSwitchProgramSession.cpp +++ b/SerialPrograms/Source/NintendoSwitch/Framework/NintendoSwitch_MultiSwitchProgramSession.cpp @@ -10,6 +10,7 @@ #include "Common/Cpp/Containers/FixedLimitVector.tpp" #include "CommonFramework/ErrorReports/ErrorReports.h" #include "CommonFramework/GlobalSettingsPanel.h" +#include "CommonFramework/Exceptions/FatalProgramException.h" #include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/Exceptions/ProgramFinishedException.h" #include "CommonFramework/Notifications/ProgramInfo.h" @@ -240,7 +241,7 @@ void MultiSwitchProgramSession::internal_run_program(){ }catch (ProgramFinishedException& e){ logger().log("Program finished early!", COLOR_BLUE); env.add_overlay_log_to_all_consoles("- Program Finished -"); - e.send_notification(env, m_option.instance().NOTIFICATION_PROGRAM_FINISH); + send_program_finished_notification(env, m_option.instance().NOTIFICATION_PROGRAM_FINISH, e.message(), *e.screenshot()); }catch (InvalidConnectionStateException& e){ logger().log("Program stopped due to connection issue.", COLOR_RED); env.add_overlay_log_to_all_consoles("- Invalid Connection -", COLOR_RED); @@ -270,19 +271,26 @@ void MultiSwitchProgramSession::internal_run_program(){ ); } - }catch (ScreenshotException& e){ + }catch (FatalProgramException& e){ logger().log("Program stopped with an exception!", COLOR_RED); env.add_overlay_log_to_all_consoles("- Program Error -", COLOR_RED); - // If the exception doesn't already have console information, - // attach the 1st console here. - e.add_stream_if_needed(env.consoles[0]); std::string message = e.message(); if (message.empty()){ message = e.name(); } report_error(message); - e.send_fatal_notification(env); + 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(), + "Recoverable: OperationFailedExceptionWithScreenshot", + {{"Message:", e.message()}}, + *e.screenshot(), + &e.video_stream()->history() + ); + } }catch (Exception& e){ logger().log("Program stopped with an exception!", COLOR_RED); env.add_overlay_log_to_all_consoles("- Program Error -", COLOR_RED); diff --git a/SerialPrograms/Source/NintendoSwitch/Framework/NintendoSwitch_SingleSwitchProgramSession.cpp b/SerialPrograms/Source/NintendoSwitch/Framework/NintendoSwitch_SingleSwitchProgramSession.cpp index 2c6cdff66d..2360ac8242 100644 --- a/SerialPrograms/Source/NintendoSwitch/Framework/NintendoSwitch_SingleSwitchProgramSession.cpp +++ b/SerialPrograms/Source/NintendoSwitch/Framework/NintendoSwitch_SingleSwitchProgramSession.cpp @@ -205,7 +205,7 @@ void SingleSwitchProgramSession::internal_run_program(){ }catch (ProgramFinishedException& e){ logger().log("Program finished early!", COLOR_BLUE); env.console.overlay().add_log("- Program Finished -"); - e.send_notification(env, m_option.instance().NOTIFICATION_PROGRAM_FINISH); + send_program_finished_notification(env, m_option.instance().NOTIFICATION_PROGRAM_FINISH, e.message(), *e.screenshot()); }catch (InvalidConnectionStateException& e){ logger().log("Program stopped due to connection issue.", COLOR_RED); env.console.overlay().add_log("- Invalid Connection -", COLOR_RED); @@ -235,16 +235,26 @@ void SingleSwitchProgramSession::internal_run_program(){ ); } - }catch (ScreenshotException& e){ + }catch (FatalProgramException& e){ logger().log("Program stopped with an exception!", COLOR_RED); env.console.overlay().add_log("- Program Error -", COLOR_RED); - e.add_stream_if_needed(env.console); + std::string message = e.message(); if (message.empty()){ message = e.name(); } report_error(message); - e.send_fatal_notification(env); + 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(), + "Recoverable: OperationFailedExceptionWithScreenshot", + {{"Message:", e.message()}}, + *e.screenshot(), + &e.video_stream()->history() + ); + } }catch (Exception& e){ logger().log("Program stopped with an exception!", COLOR_RED); env.console.overlay().add_log("- Program Error -", COLOR_RED); diff --git a/SerialPrograms/cmake/SourceFiles.cmake b/SerialPrograms/cmake/SourceFiles.cmake index faf77b84c1..dc1e52827b 100644 --- a/SerialPrograms/cmake/SourceFiles.cmake +++ b/SerialPrograms/cmake/SourceFiles.cmake @@ -402,8 +402,6 @@ file(GLOB LIBRARY_SOURCES Source/CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h Source/CommonFramework/Exceptions/ProgramFinishedException.cpp Source/CommonFramework/Exceptions/ProgramFinishedException.h - Source/CommonFramework/Exceptions/ScreenshotException.cpp - Source/CommonFramework/Exceptions/ScreenshotException.h Source/CommonFramework/Exceptions/UnexpectedBattleException.h Source/CommonFramework/GlobalAutoPaths.cpp Source/CommonFramework/GlobalAutoPaths.h From af7f9fedab64c0ce31cfebd48451f6bf72280177 Mon Sep 17 00:00:00 2001 From: jw098 Date: Wed, 26 Aug 2026 23:59:07 -0700 Subject: [PATCH 07/15] fix build --- .../Programs/RngManipulation/PokemonBDSP_BlinkRecovery.cpp | 4 ++-- .../Source/PokemonSV/Programs/Boxes/PokemonSV_BoxRoutines.h | 2 +- .../Source/PokemonSwSh/Programs/PokemonSwSh_BoxHelpers.h | 2 +- .../Source/PokemonSwSh/Programs/PokemonSwSh_MenuNavigation.h | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/SerialPrograms/Source/PokemonBDSP/Programs/RngManipulation/PokemonBDSP_BlinkRecovery.cpp b/SerialPrograms/Source/PokemonBDSP/Programs/RngManipulation/PokemonBDSP_BlinkRecovery.cpp index 3642005adc..135106301f 100644 --- a/SerialPrograms/Source/PokemonBDSP/Programs/RngManipulation/PokemonBDSP_BlinkRecovery.cpp +++ b/SerialPrograms/Source/PokemonBDSP/Programs/RngManipulation/PokemonBDSP_BlinkRecovery.cpp @@ -10,7 +10,7 @@ #include "Common/Cpp/PrettyPrint.h" #include "Common/Cpp/Logging/AbstractLogger.h" #include "CommonFramework/GlobalAutoPaths.h" -#include "CommonFramework/Exceptions/OperationFailedException.h" +#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/VideoPipeline/VideoFeed.h" #include "CommonTools/Async/InferenceSession.h" #include "NintendoSwitch/Commands/NintendoSwitch_Commands_PushButtons.h" @@ -546,7 +546,7 @@ void hold_and_reanchor( }else{ consecutive_failures++; if (consecutive_failures >= config.max_reanchor_failures){ - OperationFailedException::fire( + OperationFailedExceptionWithScreenshot::fire( ErrorReport::NO_ERROR_REPORT, std::to_string(consecutive_failures) + " consecutive re-anchor failures: the blinks can no longer be read, " diff --git a/SerialPrograms/Source/PokemonSV/Programs/Boxes/PokemonSV_BoxRoutines.h b/SerialPrograms/Source/PokemonSV/Programs/Boxes/PokemonSV_BoxRoutines.h index ad6346759e..6788c220e5 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/Boxes/PokemonSV_BoxRoutines.h +++ b/SerialPrograms/Source/PokemonSV/Programs/Boxes/PokemonSV_BoxRoutines.h @@ -35,7 +35,7 @@ bool change_view_to_stats_or_judge( // Assuming the current slot in box system is a pokemon, not egg or empty space, -// change the view to the judge. If it fails, it will OperationFailedException::fire. +// change the view to the judge. If it fails, it will OperationFailedExceptionWithScreenshot::fire. void change_view_to_judge( VideoStream& stream, ProControllerContext& context, Language language diff --git a/SerialPrograms/Source/PokemonSwSh/Programs/PokemonSwSh_BoxHelpers.h b/SerialPrograms/Source/PokemonSwSh/Programs/PokemonSwSh_BoxHelpers.h index 67eaa943dd..bdfbe80928 100644 --- a/SerialPrograms/Source/PokemonSwSh/Programs/PokemonSwSh_BoxHelpers.h +++ b/SerialPrograms/Source/PokemonSwSh/Programs/PokemonSwSh_BoxHelpers.h @@ -31,7 +31,7 @@ bool change_view_to_stats_or_judge( // Assuming the current slot in box system is a pokemon, not egg or empty space, -// change the view to the judge. If it fails, it will OperationFailedException::fire. +// change the view to the judge. If it fails, it will OperationFailedExceptionWithScreenshot::fire. void change_view_to_judge( VideoStream& stream, ProControllerContext& context, Language language diff --git a/SerialPrograms/Source/PokemonSwSh/Programs/PokemonSwSh_MenuNavigation.h b/SerialPrograms/Source/PokemonSwSh/Programs/PokemonSwSh_MenuNavigation.h index bb864d4c0f..916138bde4 100644 --- a/SerialPrograms/Source/PokemonSwSh/Programs/PokemonSwSh_MenuNavigation.h +++ b/SerialPrograms/Source/PokemonSwSh/Programs/PokemonSwSh_MenuNavigation.h @@ -29,7 +29,7 @@ constexpr size_t TOWN_MAP_APP_INDEX = 5; // The target app index is from 0 to 9, in the order of top to bottom, left to right. // e.g. by default, Pokemon app is at index 1, while Town Map app is at index 5. // The function detects the current cursor location. So the function works on any initial cursor location. -// Will OperationFailedException::fire when failed to detect menu +// Will OperationFailedExceptionWithScreenshot::fire when failed to detect menu void navigate_to_menu_app( VideoStream& stream, ProControllerContext& context, From c4509153815b5ae0786c5c3536d2c4a1a9d54385 Mon Sep 17 00:00:00 2001 From: jw098 Date: Thu, 27 Aug 2026 10:13:50 -0700 Subject: [PATCH 08/15] fix rethrowing exceptions --- .../Farming/PokemonLZA_DonutMaker.cpp | 2 +- .../AutoStory/PokemonSV_AutoStoryTools.cpp | 4 +-- .../PokemonSV_AutoStory_Segment_11.cpp | 26 +++++++++---------- .../Farming/PokemonSV_MaterialFarmerTools.cpp | 2 +- .../Programs/PokemonSV_WorldNavigation.cpp | 4 +-- 5 files changed, 19 insertions(+), 19 deletions(-) diff --git a/SerialPrograms/Source/PokemonLZA/Programs/Farming/PokemonLZA_DonutMaker.cpp b/SerialPrograms/Source/PokemonLZA/Programs/Farming/PokemonLZA_DonutMaker.cpp index 036496eb4c..a915325f4c 100644 --- a/SerialPrograms/Source/PokemonLZA/Programs/Farming/PokemonLZA_DonutMaker.cpp +++ b/SerialPrograms/Source/PokemonLZA/Programs/Farming/PokemonLZA_DonutMaker.cpp @@ -613,7 +613,7 @@ bool DonutMaker::donut_iteration( env.update_stats(); consecutive_ingredient_fails++; if (consecutive_ingredient_fails >= 3){ - throw e; + throw; } send_program_recoverable_error_notification( env, diff --git a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStoryTools.cpp b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStoryTools.cpp index 3df26bb368..c030912b2c 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStoryTools.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStoryTools.cpp @@ -1035,10 +1035,10 @@ void handle_failed_action( context.wait_for_all_requests(); action(info, stream, context); return; - }catch (OperationFailedException& e){ + }catch (OperationFailedException&){ num_failures++; if (num_failures > max_failures){ - throw e; + throw; } recovery_action(info, stream, context); } diff --git a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_11.cpp b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_11.cpp index a0a772ad19..532953ddcb 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_11.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_11.cpp @@ -289,7 +289,7 @@ void checkpoint_26( } if (i >= MAX_ATTEMPTS_SECTION_1-1){ - throw e; + throw; } if (e.m_fail_reason == OliveFail::NO_OLIVE_DETECTED || e.m_fail_reason == OliveFail::FAILED_WALK_TO_OLIVE){ // may have walked past olive @@ -299,7 +299,7 @@ void checkpoint_26( duration_to_walk_for_section1 = 800ms; push_strength_section_1 = 400ms; }else{ // FAILED_PUSH_OLIVE_TOTAL_DISTANCE - throw e; + throw; } } @@ -325,7 +325,7 @@ void checkpoint_26( break; }catch (OliveActionFailedException& e){ if (i >= MAX_ATTEMPTS_SECTION_2_1-1){ - throw e; + throw; } if (e.m_fail_reason == OliveFail::NO_OLIVE_DETECTED){ @@ -341,7 +341,7 @@ void checkpoint_26( context.wait_for_all_requests(); break; // then move on to next section }else{ // FAILED_PUSH_OLIVE_TOTAL_DISTANCE, - throw e; + throw; } } @@ -360,7 +360,7 @@ void checkpoint_26( break; }catch (OliveActionFailedException& e){ if (i >= MAX_ATTEMPTS_SECTION_2_2-1){ - throw e; + throw; } if (e.m_fail_reason == OliveFail::OLIVE_STUCK){ // olive possibly stuck on fence @@ -420,7 +420,7 @@ void checkpoint_26( } if (i >= MAX_ATTEMPTS-1){ - throw e; + throw; } if (e.m_fail_reason == OliveFail::NO_OLIVE_DETECTED || e.m_fail_reason == OliveFail::FAILED_WALK_TO_OLIVE){ // may have walked past olive @@ -429,7 +429,7 @@ void checkpoint_26( context.wait_for_all_requests(); // ticks_to_walk_for_section2_3 = 500; }else{ // FAILED_PUSH_OLIVE_TOTAL_DISTANCE - throw e; + throw; } } @@ -460,7 +460,7 @@ void checkpoint_26( }catch (OliveActionFailedException& e){ // may have failed to push the olive past the hump. and walked past it if (i >= MAX_ATTEMPTS-1){ - throw e; + throw; } if (e.m_fail_reason == OliveFail::NO_OLIVE_DETECTED){ @@ -477,7 +477,7 @@ void checkpoint_26( context.wait_for_all_requests(); duration_to_walk_for_section3_1 = 1600ms; }else{ // FAILED_PUSH_OLIVE_TOTAL_DISTANCE, - throw e; + throw; } } @@ -500,7 +500,7 @@ void checkpoint_26( }catch (OliveActionFailedException& e){ // may have failed to push the olive past the hump. and walked past it if (i >= MAX_ATTEMPTS-1){ - throw e; + throw; } if (e.m_fail_reason == OliveFail::NO_OLIVE_DETECTED){ pbf_move_left_joystick(context, {0, -1}, 1600ms, 400ms); @@ -514,7 +514,7 @@ void checkpoint_26( pbf_wait(context, 7000ms); context.wait_for_all_requests(); }else{ // FAILED_PUSH_OLIVE_TOTAL_DISTANCE, - throw e; + throw; } } @@ -547,7 +547,7 @@ void checkpoint_26( pbf_wait(context, 7000ms); context.wait_for_all_requests(); }else{ // FAILED_PUSH_OLIVE_TOTAL_DISTANCE, - throw e; + throw; } } } @@ -580,7 +580,7 @@ void checkpoint_26( // then push angled towards the right green.push_olive_forward(env.program_info(), env.console, context, 5.8, 800ms, 600ms, 20, {0, 0.3, 1.0, 0.40}, false); }else{ // FAILED_PUSH_OLIVE_TOTAL_DISTANCE, - throw e; + throw; } } } diff --git a/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_MaterialFarmerTools.cpp b/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_MaterialFarmerTools.cpp index f440923e8a..b14e12119f 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_MaterialFarmerTools.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_MaterialFarmerTools.cpp @@ -319,7 +319,7 @@ void run_material_farmer( consecutive_failures++; if (consecutive_failures >= max_consecutive_failures){ - throw e; + throw; } env.log("Reset game to handle recoverable error."); diff --git a/SerialPrograms/Source/PokemonSV/Programs/PokemonSV_WorldNavigation.cpp b/SerialPrograms/Source/PokemonSV/Programs/PokemonSV_WorldNavigation.cpp index 90cf4c8530..ae2d3257a8 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/PokemonSV_WorldNavigation.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/PokemonSV_WorldNavigation.cpp @@ -606,13 +606,13 @@ void fly_to_closest_pokecenter_on_map(const ProgramInfo& info, VideoStream& stre stream ); } - }catch (OperationFailedException& e){ + }catch (OperationFailedException&){ try_count++; if (try_count >= MAX_TRY_COUNT){ // either: // - pokecenter was detected, but failed to fly there. // - could not find pokecenter icon. - throw e; + throw; } stream.log("Failed to find the fly menuitem. Restart the closest Pokecenter travel process."); press_Bs_to_back_to_overworld(info, stream, context); From 074e8d45d3928e52a11e237c626b6f05d819d8aa Mon Sep 17 00:00:00 2001 From: jw098 Date: Thu, 27 Aug 2026 10:22:45 -0700 Subject: [PATCH 09/15] ProgramSession should also catch parent OperationFailedException --- .../Framework/ComputerProgramSession.cpp | 20 ++++++++++++++++-- ...ntendoSwitch_MultiSwitchProgramSession.cpp | 21 +++++++++++++++++-- ...tendoSwitch_SingleSwitchProgramSession.cpp | 21 +++++++++++++++++-- 3 files changed, 56 insertions(+), 6 deletions(-) diff --git a/SerialPrograms/Source/ComputerPrograms/Framework/ComputerProgramSession.cpp b/SerialPrograms/Source/ComputerPrograms/Framework/ComputerProgramSession.cpp index fbe3eac5a1..a88bd7adde 100644 --- a/SerialPrograms/Source/ComputerPrograms/Framework/ComputerProgramSession.cpp +++ b/SerialPrograms/Source/ComputerPrograms/Framework/ComputerProgramSession.cpp @@ -134,12 +134,28 @@ void ComputerProgramSession::internal_run_program(){ PokemonAutomation::report_error( &env.logger(), env.program_info(), - "Recoverable: OperationFailedExceptionWithScreenshot", + "Fatal: OperationFailedExceptionWithScreenshot", {{"Message:", e.message()}}, *e.screenshot(), &e.video_stream()->history() ); } + }catch (OperationFailedException& e){ // no screenshot + logger().log("Program stopped with an exception!", COLOR_RED); + std::string message = e.message(); + if (message.empty()){ + message = e.name(); + } + report_error(message); + send_program_fatal_error_notification(env, m_option.instance().NOTIFICATION_ERROR_FATAL, e.message()); + if (e.error_report_mode() == ErrorReport::SEND_ERROR_REPORT){ + PokemonAutomation::report_error( + &env.logger(), + env.program_info(), + "Fatal: OperationFailedException", + {{"Message:", e.message()}} + ); + } }catch (FatalProgramException& e){ logger().log("Program stopped with an exception!", COLOR_RED); std::string message = e.message(); @@ -152,7 +168,7 @@ void ComputerProgramSession::internal_run_program(){ PokemonAutomation::report_error( &env.logger(), env.program_info(), - "Recoverable: OperationFailedExceptionWithScreenshot", + "FatalProgramException", {{"Message:", e.message()}}, *e.screenshot(), &e.video_stream()->history() diff --git a/SerialPrograms/Source/NintendoSwitch/Framework/NintendoSwitch_MultiSwitchProgramSession.cpp b/SerialPrograms/Source/NintendoSwitch/Framework/NintendoSwitch_MultiSwitchProgramSession.cpp index 65e227c448..a8d3da67f8 100644 --- a/SerialPrograms/Source/NintendoSwitch/Framework/NintendoSwitch_MultiSwitchProgramSession.cpp +++ b/SerialPrograms/Source/NintendoSwitch/Framework/NintendoSwitch_MultiSwitchProgramSession.cpp @@ -264,13 +264,30 @@ void MultiSwitchProgramSession::internal_run_program(){ PokemonAutomation::report_error( &env.logger(), env.program_info(), - "Recoverable: OperationFailedExceptionWithScreenshot", + "Fatal: OperationFailedExceptionWithScreenshot", {{"Message:", e.message()}}, *e.screenshot(), &e.video_stream()->history() ); } + }catch (OperationFailedException& e){ // no screenshot + logger().log("Program stopped with an exception!", COLOR_RED); + env.add_overlay_log_to_all_consoles("- Program Error -", COLOR_RED); + std::string message = e.message(); + if (message.empty()){ + message = e.name(); + } + report_error(message); + send_program_fatal_error_notification(env, m_option.instance().NOTIFICATION_ERROR_FATAL, e.message()); + if (e.error_report_mode() == ErrorReport::SEND_ERROR_REPORT){ + PokemonAutomation::report_error( + &env.logger(), + env.program_info(), + "Fatal: OperationFailedException", + {{"Message:", e.message()}} + ); + } }catch (FatalProgramException& e){ logger().log("Program stopped with an exception!", COLOR_RED); env.add_overlay_log_to_all_consoles("- Program Error -", COLOR_RED); @@ -285,7 +302,7 @@ void MultiSwitchProgramSession::internal_run_program(){ PokemonAutomation::report_error( &env.logger(), env.program_info(), - "Recoverable: OperationFailedExceptionWithScreenshot", + "FatalProgramException", {{"Message:", e.message()}}, *e.screenshot(), &e.video_stream()->history() diff --git a/SerialPrograms/Source/NintendoSwitch/Framework/NintendoSwitch_SingleSwitchProgramSession.cpp b/SerialPrograms/Source/NintendoSwitch/Framework/NintendoSwitch_SingleSwitchProgramSession.cpp index 2360ac8242..b6d1b069f7 100644 --- a/SerialPrograms/Source/NintendoSwitch/Framework/NintendoSwitch_SingleSwitchProgramSession.cpp +++ b/SerialPrograms/Source/NintendoSwitch/Framework/NintendoSwitch_SingleSwitchProgramSession.cpp @@ -228,13 +228,30 @@ void SingleSwitchProgramSession::internal_run_program(){ PokemonAutomation::report_error( &env.logger(), env.program_info(), - "Recoverable: OperationFailedExceptionWithScreenshot", + "Fatal: OperationFailedExceptionWithScreenshot", {{"Message:", e.message()}}, *e.screenshot(), &e.video_stream()->history() ); } + }catch (OperationFailedException& e){ // no screenshot + logger().log("Program stopped with an exception!", COLOR_RED); + env.console.overlay().add_log("- Program Error -", COLOR_RED); + std::string message = e.message(); + if (message.empty()){ + message = e.name(); + } + report_error(message); + send_program_fatal_error_notification(env, m_option.instance().NOTIFICATION_ERROR_FATAL, e.message()); + if (e.error_report_mode() == ErrorReport::SEND_ERROR_REPORT){ + PokemonAutomation::report_error( + &env.logger(), + env.program_info(), + "Fatal: OperationFailedException", + {{"Message:", e.message()}} + ); + } }catch (FatalProgramException& e){ logger().log("Program stopped with an exception!", COLOR_RED); env.console.overlay().add_log("- Program Error -", COLOR_RED); @@ -249,7 +266,7 @@ void SingleSwitchProgramSession::internal_run_program(){ PokemonAutomation::report_error( &env.logger(), env.program_info(), - "Recoverable: OperationFailedExceptionWithScreenshot", + "FatalProgramException", {{"Message:", e.message()}}, *e.screenshot(), &e.video_stream()->history() From 34280009bd626297a83d5eddbd32df0ba0c04efa Mon Sep 17 00:00:00 2001 From: jw098 Date: Thu, 27 Aug 2026 22:27:53 -0700 Subject: [PATCH 10/15] remove ErrorReport from ProgramFinishedException --- .../CommonFramework/Exceptions/ProgramFinishedException.cpp | 1 - .../Source/CommonFramework/Exceptions/ProgramFinishedException.h | 1 - 2 files changed, 2 deletions(-) diff --git a/SerialPrograms/Source/CommonFramework/Exceptions/ProgramFinishedException.cpp b/SerialPrograms/Source/CommonFramework/Exceptions/ProgramFinishedException.cpp index 5e5ea7ad02..a47c52dde4 100644 --- a/SerialPrograms/Source/CommonFramework/Exceptions/ProgramFinishedException.cpp +++ b/SerialPrograms/Source/CommonFramework/Exceptions/ProgramFinishedException.cpp @@ -26,7 +26,6 @@ ProgramFinishedException::ProgramFinishedException( , m_screenshot(stream.video().snapshot().frame) {} ProgramFinishedException::ProgramFinishedException( - ErrorReport error_report, std::string message, VideoStream* stream, ImageRGB32 screenshot diff --git a/SerialPrograms/Source/CommonFramework/Exceptions/ProgramFinishedException.h b/SerialPrograms/Source/CommonFramework/Exceptions/ProgramFinishedException.h index c358a3bcd7..cf39dc356f 100644 --- a/SerialPrograms/Source/CommonFramework/Exceptions/ProgramFinishedException.h +++ b/SerialPrograms/Source/CommonFramework/Exceptions/ProgramFinishedException.h @@ -41,7 +41,6 @@ class ProgramFinishedException : public Exception{ // Use the provided screenshot instead of taking one with the console. // Store the console information (if provided) for stream history if requested later. explicit ProgramFinishedException( - ErrorReport error_report, std::string message, VideoStream* stream, ImageRGB32 screenshot From af060d616404554a15ebce8796bea6d6f15f5ba9 Mon Sep 17 00:00:00 2001 From: jw098 Date: Thu, 27 Aug 2026 23:32:56 -0700 Subject: [PATCH 11/15] add helper function that sends notification and telemetry report --- .../Notifications/ProgramNotifications.cpp | 47 +++++++++++++++ .../Notifications/ProgramNotifications.h | 24 ++++++++ .../Framework/ComputerProgramSession.cpp | 56 ++++++++--------- ...ntendoSwitch_MultiSwitchProgramSession.cpp | 56 ++++++++--------- ...tendoSwitch_SingleSwitchProgramSession.cpp | 56 ++++++++--------- .../Eggs/PokemonBDSP_EggAutonomous.cpp | 21 +++---- .../PokemonBDSP_ShinyHunt-Overworld.cpp | 20 +++---- .../Farming/PokemonLA_LeapGrinder.cpp | 20 +++---- .../PokemonLA_NuggetFarmerHighlands.cpp | 20 +++---- .../General/PokemonLA_RamanasIslandCombee.cpp | 20 +++---- .../ShinyHunting/PokemonLA_BurmyFinder.cpp | 20 +++---- .../ShinyHunting/PokemonLA_CrobatFinder.cpp | 20 +++---- .../ShinyHunting/PokemonLA_FroslassFinder.cpp | 20 +++---- .../ShinyHunting/PokemonLA_GalladeFinder.cpp | 20 +++---- .../PokemonLA_PostMMOSpawnReset.cpp | 20 +++---- .../PokemonLA_ShinyHunt-CustomPath.cpp | 20 +++---- .../PokemonLA_ShinyHunt-FlagPin.cpp | 20 +++---- .../ShinyHunting/PokemonLA_UnownFinder.cpp | 20 +++---- .../PokemonLGPE_LegendaryReset.cpp | 20 +++---- .../ShinyHunting/PokemonLZA_BeldumHunter.cpp | 20 +++---- .../Programs/Boxes/PokemonSV_BoxRoutines.cpp | 40 ++++++------- .../Farming/PokemonSV_AuctionFarmer.cpp | 20 +++---- .../Farming/PokemonSV_MaterialFarmerTools.cpp | 20 +++---- .../Glitches/PokemonSV_CloneItems-1.0.1.cpp | 40 ++++++------- .../Glitches/PokemonSV_RideCloner-1.0.1.cpp | 20 +++---- .../PokemonSV_ShinyHunt-AreaZeroPlatform.cpp | 20 +++---- .../PokemonSV_ShinyHunt-Scatterbug.cpp | 20 +++---- .../Programs/TeraRaids/PokemonSV_AutoHost.cpp | 60 +++++++++---------- .../TeraRaids/PokemonSV_TeraMultiFarmer.cpp | 20 +++---- .../EggPrograms/PokemonSwSh_EggAutonomous.cpp | 20 +++---- 30 files changed, 407 insertions(+), 413 deletions(-) diff --git a/SerialPrograms/Source/CommonFramework/Notifications/ProgramNotifications.cpp b/SerialPrograms/Source/CommonFramework/Notifications/ProgramNotifications.cpp index 816568cbce..c1092c6cb2 100644 --- a/SerialPrograms/Source/CommonFramework/Notifications/ProgramNotifications.cpp +++ b/SerialPrograms/Source/CommonFramework/Notifications/ProgramNotifications.cpp @@ -9,6 +9,7 @@ #include "Common/Cpp/Json/JsonValue.h" #include "Common/Cpp/Json/JsonArray.h" #include "Common/Cpp/Json/JsonObject.h" +#include "CommonFramework/ErrorReports/ErrorReports.h" #include "CommonFramework/Globals.h" #include "CommonFramework/StaticGlobals.h" #include "CommonFramework/GlobalSettingsPanel.h" @@ -370,7 +371,53 @@ void send_program_fatal_error_notification( ); } +void send_program_recoverable_error_notification_and_telemetry_report( + ProgramEnvironment& env, + Logger* logger, + const ProgramInfo& info, + EventNotificationOption& notif_settings, + ErrorReport error_report_mode, + const std::string& message, + std::string error_type, + const ImageViewRGB32& image, + const StreamHistorySession* stream_history +){ + send_program_recoverable_error_notification(env, notif_settings, message, image); + if (error_report_mode == ErrorReport::SEND_ERROR_REPORT){ + report_error( + logger, + info, + "Recoverable: " + error_type, + {{"Message:", message}}, + image, + stream_history + ); + } +} +void send_program_fatal_error_notification_and_telemetry_report( + ProgramEnvironment& env, + Logger* logger, + const ProgramInfo& info, + EventNotificationOption& notif_settings, + ErrorReport error_report_mode, + const std::string& message, + std::string error_type, + const ImageViewRGB32& image, + const StreamHistorySession* stream_history +){ + send_program_fatal_error_notification(env, notif_settings, message, image); + if (error_report_mode == ErrorReport::SEND_ERROR_REPORT){ + report_error( + logger, + info, + "Fatal: " + error_type, + {{"Message:", message}}, + image, + stream_history + ); + } +} diff --git a/SerialPrograms/Source/CommonFramework/Notifications/ProgramNotifications.h b/SerialPrograms/Source/CommonFramework/Notifications/ProgramNotifications.h index 6a7ec679c1..cb81e29144 100644 --- a/SerialPrograms/Source/CommonFramework/Notifications/ProgramNotifications.h +++ b/SerialPrograms/Source/CommonFramework/Notifications/ProgramNotifications.h @@ -9,6 +9,7 @@ #include #include +#include "Common/Cpp/Exceptions.h" #include "CommonFramework/ImageTypes/ImageViewRGB32.h" #include "ProgramInfo.h" #include "EventNotificationOption.h" @@ -18,6 +19,7 @@ namespace PokemonAutomation{ class Logger; class StatsTracker; class ProgramEnvironment; +class StreamHistorySession; @@ -156,7 +158,29 @@ void send_program_fatal_error_notification( ); +void send_program_recoverable_error_notification_and_telemetry_report( + ProgramEnvironment& env, + Logger* logger, + const ProgramInfo& info, + EventNotificationOption& notif_settings, + ErrorReport error_report_mode, + const std::string& message, + std::string error_type, + const ImageViewRGB32& image = ImageViewRGB32(), + const StreamHistorySession* stream_history = nullptr +); +void send_program_fatal_error_notification_and_telemetry_report( + ProgramEnvironment& env, + Logger* logger, + const ProgramInfo& info, + EventNotificationOption& notif_settings, + ErrorReport error_report_mode, + const std::string& message, + std::string error_type, + const ImageViewRGB32& image = ImageViewRGB32(), + const StreamHistorySession* stream_history = nullptr +); diff --git a/SerialPrograms/Source/ComputerPrograms/Framework/ComputerProgramSession.cpp b/SerialPrograms/Source/ComputerPrograms/Framework/ComputerProgramSession.cpp index a88bd7adde..2ea6b380ab 100644 --- a/SerialPrograms/Source/ComputerPrograms/Framework/ComputerProgramSession.cpp +++ b/SerialPrograms/Source/ComputerPrograms/Framework/ComputerProgramSession.cpp @@ -129,17 +129,15 @@ void ComputerProgramSession::internal_run_program(){ message = e.name(); } report_error(message); - 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() - ); - } + 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() + ); }catch (OperationFailedException& e){ // no screenshot logger().log("Program stopped with an exception!", COLOR_RED); std::string message = e.message(); @@ -147,15 +145,13 @@ void ComputerProgramSession::internal_run_program(){ message = e.name(); } report_error(message); - send_program_fatal_error_notification(env, m_option.instance().NOTIFICATION_ERROR_FATAL, e.message()); - if (e.error_report_mode() == ErrorReport::SEND_ERROR_REPORT){ - PokemonAutomation::report_error( - &env.logger(), - env.program_info(), - "Fatal: OperationFailedException", - {{"Message:", e.message()}} - ); - } + 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(), + "OperationFailedException" + ); }catch (FatalProgramException& e){ logger().log("Program stopped with an exception!", COLOR_RED); std::string message = e.message(); @@ -163,17 +159,15 @@ void ComputerProgramSession::internal_run_program(){ message = e.name(); } report_error(message); - 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(), - "FatalProgramException", - {{"Message:", e.message()}}, - *e.screenshot(), - &e.video_stream()->history() - ); - } + 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(), + "FatalProgramException", + *e.screenshot(), + &e.video_stream()->history() + ); }catch (Exception& e){ logger().log("Program stopped with an exception!", COLOR_RED); std::string message = e.message(); diff --git a/SerialPrograms/Source/NintendoSwitch/Framework/NintendoSwitch_MultiSwitchProgramSession.cpp b/SerialPrograms/Source/NintendoSwitch/Framework/NintendoSwitch_MultiSwitchProgramSession.cpp index a8d3da67f8..214cc409d2 100644 --- a/SerialPrograms/Source/NintendoSwitch/Framework/NintendoSwitch_MultiSwitchProgramSession.cpp +++ b/SerialPrograms/Source/NintendoSwitch/Framework/NintendoSwitch_MultiSwitchProgramSession.cpp @@ -259,17 +259,15 @@ void MultiSwitchProgramSession::internal_run_program(){ message = e.name(); } report_error(message); - 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() - ); - } + 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() + ); }catch (OperationFailedException& e){ // no screenshot logger().log("Program stopped with an exception!", COLOR_RED); env.add_overlay_log_to_all_consoles("- Program Error -", COLOR_RED); @@ -279,15 +277,13 @@ void MultiSwitchProgramSession::internal_run_program(){ message = e.name(); } report_error(message); - send_program_fatal_error_notification(env, m_option.instance().NOTIFICATION_ERROR_FATAL, e.message()); - if (e.error_report_mode() == ErrorReport::SEND_ERROR_REPORT){ - PokemonAutomation::report_error( - &env.logger(), - env.program_info(), - "Fatal: OperationFailedException", - {{"Message:", e.message()}} - ); - } + 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(), + "OperationFailedException" + ); }catch (FatalProgramException& e){ logger().log("Program stopped with an exception!", COLOR_RED); env.add_overlay_log_to_all_consoles("- Program Error -", COLOR_RED); @@ -297,17 +293,15 @@ void MultiSwitchProgramSession::internal_run_program(){ message = e.name(); } report_error(message); - 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(), - "FatalProgramException", - {{"Message:", e.message()}}, - *e.screenshot(), - &e.video_stream()->history() - ); - } + 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(), + "FatalProgramException", + *e.screenshot(), + &e.video_stream()->history() + ); }catch (Exception& e){ logger().log("Program stopped with an exception!", COLOR_RED); env.add_overlay_log_to_all_consoles("- Program Error -", COLOR_RED); diff --git a/SerialPrograms/Source/NintendoSwitch/Framework/NintendoSwitch_SingleSwitchProgramSession.cpp b/SerialPrograms/Source/NintendoSwitch/Framework/NintendoSwitch_SingleSwitchProgramSession.cpp index b6d1b069f7..8916dd8f77 100644 --- a/SerialPrograms/Source/NintendoSwitch/Framework/NintendoSwitch_SingleSwitchProgramSession.cpp +++ b/SerialPrograms/Source/NintendoSwitch/Framework/NintendoSwitch_SingleSwitchProgramSession.cpp @@ -223,17 +223,15 @@ void SingleSwitchProgramSession::internal_run_program(){ message = e.name(); } report_error(message); - 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() - ); - } + 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() + ); }catch (OperationFailedException& e){ // no screenshot logger().log("Program stopped with an exception!", COLOR_RED); env.console.overlay().add_log("- Program Error -", COLOR_RED); @@ -243,15 +241,13 @@ void SingleSwitchProgramSession::internal_run_program(){ message = e.name(); } report_error(message); - send_program_fatal_error_notification(env, m_option.instance().NOTIFICATION_ERROR_FATAL, e.message()); - if (e.error_report_mode() == ErrorReport::SEND_ERROR_REPORT){ - PokemonAutomation::report_error( - &env.logger(), - env.program_info(), - "Fatal: OperationFailedException", - {{"Message:", e.message()}} - ); - } + 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(), + "OperationFailedException" + ); }catch (FatalProgramException& e){ logger().log("Program stopped with an exception!", COLOR_RED); env.console.overlay().add_log("- Program Error -", COLOR_RED); @@ -261,17 +257,15 @@ void SingleSwitchProgramSession::internal_run_program(){ message = e.name(); } report_error(message); - 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(), - "FatalProgramException", - {{"Message:", e.message()}}, - *e.screenshot(), - &e.video_stream()->history() - ); - } + 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(), + "FatalProgramException", + *e.screenshot(), + &e.video_stream()->history() + ); }catch (Exception& e){ logger().log("Program stopped with an exception!", COLOR_RED); env.console.overlay().add_log("- Program Error -", COLOR_RED); diff --git a/SerialPrograms/Source/PokemonBDSP/Programs/Eggs/PokemonBDSP_EggAutonomous.cpp b/SerialPrograms/Source/PokemonBDSP/Programs/Eggs/PokemonBDSP_EggAutonomous.cpp index f0f56c2629..e9394bfd9e 100644 --- a/SerialPrograms/Source/PokemonBDSP/Programs/Eggs/PokemonBDSP_EggAutonomous.cpp +++ b/SerialPrograms/Source/PokemonBDSP/Programs/Eggs/PokemonBDSP_EggAutonomous.cpp @@ -5,7 +5,6 @@ */ #include "Common/Compiler.h" -#include "CommonFramework/ErrorReports/ErrorReports.h" #include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/Notifications/ProgramNotifications.h" #include "NintendoSwitch/NintendoSwitch_Settings.h" @@ -224,17 +223,15 @@ void EggAutonomous::program(SingleSwitchProgramEnvironment& env, ProControllerCo if (AUTO_SAVING == AutoSave::NoAutoSave){ throw; } - send_program_recoverable_error_notification(env, NOTIFICATION_ERROR_RECOVERABLE, e.message(), *e.screenshot()); - if (e.error_report_mode() == ErrorReport::SEND_ERROR_REPORT){ - PokemonAutomation::report_error( - &env.logger(), - env.program_info(), - "Recoverable: OperationFailedExceptionWithScreenshot", - {{"Message:", e.message()}}, - *e.screenshot(), - &e.video_stream()->history() - ); - } + send_program_recoverable_error_notification_and_telemetry_report( + env, &env.logger(), env.program_info(), + NOTIFICATION_ERROR_RECOVERABLE, + e.error_report_mode(), + e.message(), + "OperationFailedExceptionWithScreenshot", + *e.screenshot(), + &e.video_stream()->history() + ); consecutive_failures++; if (consecutive_failures >= 3){ diff --git a/SerialPrograms/Source/PokemonBDSP/Programs/ShinyHunting/PokemonBDSP_ShinyHunt-Overworld.cpp b/SerialPrograms/Source/PokemonBDSP/Programs/ShinyHunting/PokemonBDSP_ShinyHunt-Overworld.cpp index 52b69d831d..0f0e2c9aca 100644 --- a/SerialPrograms/Source/PokemonBDSP/Programs/ShinyHunting/PokemonBDSP_ShinyHunt-Overworld.cpp +++ b/SerialPrograms/Source/PokemonBDSP/Programs/ShinyHunting/PokemonBDSP_ShinyHunt-Overworld.cpp @@ -153,17 +153,15 @@ void ShinyHuntOverworld::program(SingleSwitchProgramEnvironment& env, ProControl if (!RESET_GAME_WHEN_ERROR){ throw; } - send_program_recoverable_error_notification(env, NOTIFICATION_ERROR_RECOVERABLE, e.message(), *e.screenshot()); - if (e.error_report_mode() == ErrorReport::SEND_ERROR_REPORT){ - PokemonAutomation::report_error( - &env.logger(), - env.program_info(), - "Recoverable: OperationFailedExceptionWithScreenshot", - {{"Message:", e.message()}}, - *e.screenshot(), - &e.video_stream()->history() - ); - } + send_program_recoverable_error_notification_and_telemetry_report( + env, &env.logger(), env.program_info(), + NOTIFICATION_ERROR_RECOVERABLE, + e.error_report_mode(), + e.message(), + "OperationFailedExceptionWithScreenshot", + *e.screenshot(), + &e.video_stream()->history() + ); stats.add_error(); go_home(env.console, context); diff --git a/SerialPrograms/Source/PokemonLA/Programs/Farming/PokemonLA_LeapGrinder.cpp b/SerialPrograms/Source/PokemonLA/Programs/Farming/PokemonLA_LeapGrinder.cpp index c82274cef3..c8c084dcb8 100644 --- a/SerialPrograms/Source/PokemonLA/Programs/Farming/PokemonLA_LeapGrinder.cpp +++ b/SerialPrograms/Source/PokemonLA/Programs/Farming/PokemonLA_LeapGrinder.cpp @@ -314,17 +314,15 @@ void LeapGrinder::program(SingleSwitchProgramEnvironment& env, ProControllerCont } }catch (OperationFailedExceptionWithScreenshot& e){ stats.errors++; - send_program_recoverable_error_notification(env, NOTIFICATION_ERROR_RECOVERABLE, e.message(), *e.screenshot()); - if (e.error_report_mode() == ErrorReport::SEND_ERROR_REPORT){ - PokemonAutomation::report_error( - &env.logger(), - env.program_info(), - "Recoverable: OperationFailedExceptionWithScreenshot", - {{"Message:", e.message()}}, - *e.screenshot(), - &e.video_stream()->history() - ); - } + send_program_recoverable_error_notification_and_telemetry_report( + env, &env.logger(), env.program_info(), + NOTIFICATION_ERROR_RECOVERABLE, + e.error_report_mode(), + e.message(), + "OperationFailedExceptionWithScreenshot", + *e.screenshot(), + &e.video_stream()->history() + ); pbf_press_button(context, BUTTON_HOME, 160ms, GameSettings::instance().GAME_TO_HOME_DELAY0); fresh_from_reset = reset_game_from_home(env, env.console, context); diff --git a/SerialPrograms/Source/PokemonLA/Programs/Farming/PokemonLA_NuggetFarmerHighlands.cpp b/SerialPrograms/Source/PokemonLA/Programs/Farming/PokemonLA_NuggetFarmerHighlands.cpp index b3156894ae..f8ec60def8 100644 --- a/SerialPrograms/Source/PokemonLA/Programs/Farming/PokemonLA_NuggetFarmerHighlands.cpp +++ b/SerialPrograms/Source/PokemonLA/Programs/Farming/PokemonLA_NuggetFarmerHighlands.cpp @@ -235,17 +235,15 @@ void NuggetFarmerHighlands::program(SingleSwitchProgramEnvironment& env, ProCont } }catch (OperationFailedExceptionWithScreenshot& e){ stats.errors++; - send_program_recoverable_error_notification(env, NOTIFICATION_ERROR_RECOVERABLE, e.message(), *e.screenshot()); - if (e.error_report_mode() == ErrorReport::SEND_ERROR_REPORT){ - PokemonAutomation::report_error( - &env.logger(), - env.program_info(), - "Recoverable: OperationFailedExceptionWithScreenshot", - {{"Message:", e.message()}}, - *e.screenshot(), - &e.video_stream()->history() - ); - } + send_program_recoverable_error_notification_and_telemetry_report( + env, &env.logger(), env.program_info(), + NOTIFICATION_ERROR_RECOVERABLE, + e.error_report_mode(), + e.message(), + "OperationFailedExceptionWithScreenshot", + *e.screenshot(), + &e.video_stream()->history() + ); pbf_press_button(context, BUTTON_HOME, 160ms, GameSettings::instance().GAME_TO_HOME_DELAY0); fresh_from_reset = reset_game_from_home(env, env.console, context); diff --git a/SerialPrograms/Source/PokemonLA/Programs/General/PokemonLA_RamanasIslandCombee.cpp b/SerialPrograms/Source/PokemonLA/Programs/General/PokemonLA_RamanasIslandCombee.cpp index a5919fe2f4..af861a2e99 100644 --- a/SerialPrograms/Source/PokemonLA/Programs/General/PokemonLA_RamanasIslandCombee.cpp +++ b/SerialPrograms/Source/PokemonLA/Programs/General/PokemonLA_RamanasIslandCombee.cpp @@ -339,17 +339,15 @@ void RamanasCombeeFinder::program(SingleSwitchProgramEnvironment& env, ProContro run_iteration(env, context, fresh_from_reset); }catch (OperationFailedExceptionWithScreenshot& e){ stats.errors++; - send_program_recoverable_error_notification(env, NOTIFICATION_ERROR_RECOVERABLE, e.message(), *e.screenshot()); - if (e.error_report_mode() == ErrorReport::SEND_ERROR_REPORT){ - PokemonAutomation::report_error( - &env.logger(), - env.program_info(), - "Recoverable: OperationFailedExceptionWithScreenshot", - {{"Message:", e.message()}}, - *e.screenshot(), - &e.video_stream()->history() - ); - } + send_program_recoverable_error_notification_and_telemetry_report( + env, &env.logger(), env.program_info(), + NOTIFICATION_ERROR_RECOVERABLE, + e.error_report_mode(), + e.message(), + "OperationFailedExceptionWithScreenshot", + *e.screenshot(), + &e.video_stream()->history() + ); pbf_press_button(context, BUTTON_HOME, 160ms, GameSettings::instance().GAME_TO_HOME_DELAY0); fresh_from_reset = reset_game_from_home(env, env.console, context); diff --git a/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_BurmyFinder.cpp b/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_BurmyFinder.cpp index e666ea1af2..2751d54b3f 100644 --- a/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_BurmyFinder.cpp +++ b/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_BurmyFinder.cpp @@ -841,17 +841,15 @@ void BurmyFinder::program(SingleSwitchProgramEnvironment& env, ProControllerCont run_iteration(env, context, counters, fresh_from_reset); }catch (OperationFailedExceptionWithScreenshot& e){ stats.errors++; - send_program_recoverable_error_notification(env, NOTIFICATION_ERROR_RECOVERABLE, e.message(), *e.screenshot()); - if (e.error_report_mode() == ErrorReport::SEND_ERROR_REPORT){ - PokemonAutomation::report_error( - &env.logger(), - env.program_info(), - "Recoverable: OperationFailedExceptionWithScreenshot", - {{"Message:", e.message()}}, - *e.screenshot(), - &e.video_stream()->history() - ); - } + send_program_recoverable_error_notification_and_telemetry_report( + env, &env.logger(), env.program_info(), + NOTIFICATION_ERROR_RECOVERABLE, + e.error_report_mode(), + e.message(), + "OperationFailedExceptionWithScreenshot", + *e.screenshot(), + &e.video_stream()->history() + ); pbf_press_button(context, BUTTON_HOME, 160ms, GameSettings::instance().GAME_TO_HOME_DELAY0); fresh_from_reset = reset_game_from_home( diff --git a/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_CrobatFinder.cpp b/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_CrobatFinder.cpp index 97a74f7589..78fe96a725 100644 --- a/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_CrobatFinder.cpp +++ b/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_CrobatFinder.cpp @@ -200,17 +200,15 @@ void CrobatFinder::program(SingleSwitchProgramEnvironment& env, ProControllerCon run_iteration(env, context); }catch (OperationFailedExceptionWithScreenshot& e){ stats.errors++; - send_program_recoverable_error_notification(env, NOTIFICATION_ERROR_RECOVERABLE, e.message(), *e.screenshot()); - if (e.error_report_mode() == ErrorReport::SEND_ERROR_REPORT){ - PokemonAutomation::report_error( - &env.logger(), - env.program_info(), - "Recoverable: OperationFailedExceptionWithScreenshot", - {{"Message:", e.message()}}, - *e.screenshot(), - &e.video_stream()->history() - ); - } + send_program_recoverable_error_notification_and_telemetry_report( + env, &env.logger(), env.program_info(), + NOTIFICATION_ERROR_RECOVERABLE, + e.error_report_mode(), + e.message(), + "OperationFailedExceptionWithScreenshot", + *e.screenshot(), + &e.video_stream()->history() + ); pbf_press_button(context, BUTTON_HOME, 160ms, GameSettings::instance().GAME_TO_HOME_DELAY0); reset_game_from_home(env, env.console, context); diff --git a/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_FroslassFinder.cpp b/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_FroslassFinder.cpp index 4dff303dc4..c5a8a6c656 100644 --- a/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_FroslassFinder.cpp +++ b/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_FroslassFinder.cpp @@ -189,17 +189,15 @@ void FroslassFinder::program(SingleSwitchProgramEnvironment& env, ProControllerC run_iteration(env, context, fresh_from_reset); }catch (OperationFailedExceptionWithScreenshot& e){ stats.errors++; - send_program_recoverable_error_notification(env, NOTIFICATION_ERROR_RECOVERABLE, e.message(), *e.screenshot()); - if (e.error_report_mode() == ErrorReport::SEND_ERROR_REPORT){ - PokemonAutomation::report_error( - &env.logger(), - env.program_info(), - "Recoverable: OperationFailedExceptionWithScreenshot", - {{"Message:", e.message()}}, - *e.screenshot(), - &e.video_stream()->history() - ); - } + send_program_recoverable_error_notification_and_telemetry_report( + env, &env.logger(), env.program_info(), + NOTIFICATION_ERROR_RECOVERABLE, + e.error_report_mode(), + e.message(), + "OperationFailedExceptionWithScreenshot", + *e.screenshot(), + &e.video_stream()->history() + ); pbf_press_button(context, BUTTON_HOME, 160ms, GameSettings::instance().GAME_TO_HOME_DELAY0); fresh_from_reset = reset_game_from_home( diff --git a/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_GalladeFinder.cpp b/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_GalladeFinder.cpp index 15fcb4813d..6d95f8ef92 100644 --- a/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_GalladeFinder.cpp +++ b/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_GalladeFinder.cpp @@ -183,17 +183,15 @@ void GalladeFinder::program(SingleSwitchProgramEnvironment& env, ProControllerCo run_iteration(env, context); }catch (OperationFailedExceptionWithScreenshot& e){ stats.errors++; - send_program_recoverable_error_notification(env, NOTIFICATION_ERROR_RECOVERABLE, e.message(), *e.screenshot()); - if (e.error_report_mode() == ErrorReport::SEND_ERROR_REPORT){ - PokemonAutomation::report_error( - &env.logger(), - env.program_info(), - "Recoverable: OperationFailedExceptionWithScreenshot", - {{"Message:", e.message()}}, - *e.screenshot(), - &e.video_stream()->history() - ); - } + send_program_recoverable_error_notification_and_telemetry_report( + env, &env.logger(), env.program_info(), + NOTIFICATION_ERROR_RECOVERABLE, + e.error_report_mode(), + e.message(), + "OperationFailedExceptionWithScreenshot", + *e.screenshot(), + &e.video_stream()->history() + ); pbf_press_button(context, BUTTON_HOME, 160ms, GameSettings::instance().GAME_TO_HOME_DELAY0); reset_game_from_home(env, env.console, context); diff --git a/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_PostMMOSpawnReset.cpp b/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_PostMMOSpawnReset.cpp index e9105f326c..ed03b8ba96 100644 --- a/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_PostMMOSpawnReset.cpp +++ b/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_PostMMOSpawnReset.cpp @@ -154,17 +154,15 @@ void PostMMOSpawnReset::program(SingleSwitchProgramEnvironment& env, ProControll run_iteration(env, context); }catch (OperationFailedExceptionWithScreenshot& e){ stats.errors++; - send_program_recoverable_error_notification(env, NOTIFICATION_ERROR_RECOVERABLE, e.message(), *e.screenshot()); - if (e.error_report_mode() == ErrorReport::SEND_ERROR_REPORT){ - PokemonAutomation::report_error( - &env.logger(), - env.program_info(), - "Recoverable: OperationFailedExceptionWithScreenshot", - {{"Message:", e.message()}}, - *e.screenshot(), - &e.video_stream()->history() - ); - } + send_program_recoverable_error_notification_and_telemetry_report( + env, &env.logger(), env.program_info(), + NOTIFICATION_ERROR_RECOVERABLE, + e.error_report_mode(), + e.message(), + "OperationFailedExceptionWithScreenshot", + *e.screenshot(), + &e.video_stream()->history() + ); // run_iteration() restarts the game first then listens to shiny sound. // If there is any error generated when the game is running and is caught here, diff --git a/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_ShinyHunt-CustomPath.cpp b/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_ShinyHunt-CustomPath.cpp index 6e772f672a..486f01c8e5 100644 --- a/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_ShinyHunt-CustomPath.cpp +++ b/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_ShinyHunt-CustomPath.cpp @@ -313,17 +313,15 @@ void ShinyHuntCustomPath::program(SingleSwitchProgramEnvironment& env, ProContro }catch (OperationFailedExceptionWithScreenshot& e){ stats.errors++; - send_program_recoverable_error_notification(env, NOTIFICATION_ERROR_RECOVERABLE, e.message(), *e.screenshot()); - if (e.error_report_mode() == ErrorReport::SEND_ERROR_REPORT){ - PokemonAutomation::report_error( - &env.logger(), - env.program_info(), - "Recoverable: OperationFailedExceptionWithScreenshot", - {{"Message:", e.message()}}, - *e.screenshot(), - &e.video_stream()->history() - ); - } + send_program_recoverable_error_notification_and_telemetry_report( + env, &env.logger(), env.program_info(), + NOTIFICATION_ERROR_RECOVERABLE, + e.error_report_mode(), + e.message(), + "OperationFailedExceptionWithScreenshot", + *e.screenshot(), + &e.video_stream()->history() + ); time_reset_run_count = 0; pbf_press_button(context, BUTTON_HOME, 160ms, GameSettings::instance().GAME_TO_HOME_DELAY0); diff --git a/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_ShinyHunt-FlagPin.cpp b/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_ShinyHunt-FlagPin.cpp index 9058ae1e4b..ea89f4aad7 100644 --- a/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_ShinyHunt-FlagPin.cpp +++ b/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_ShinyHunt-FlagPin.cpp @@ -202,17 +202,15 @@ void ShinyHuntFlagPin::program(SingleSwitchProgramEnvironment& env, ProControlle run_iteration(env, context, fresh_from_reset); }catch (OperationFailedExceptionWithScreenshot& e){ stats.errors++; - send_program_recoverable_error_notification(env, NOTIFICATION_ERROR_RECOVERABLE, e.message(), *e.screenshot()); - if (e.error_report_mode() == ErrorReport::SEND_ERROR_REPORT){ - PokemonAutomation::report_error( - &env.logger(), - env.program_info(), - "Recoverable: OperationFailedExceptionWithScreenshot", - {{"Message:", e.message()}}, - *e.screenshot(), - &e.video_stream()->history() - ); - } + send_program_recoverable_error_notification_and_telemetry_report( + env, &env.logger(), env.program_info(), + NOTIFICATION_ERROR_RECOVERABLE, + e.error_report_mode(), + e.message(), + "OperationFailedExceptionWithScreenshot", + *e.screenshot(), + &e.video_stream()->history() + ); pbf_press_button(context, BUTTON_HOME, 160ms, GameSettings::instance().GAME_TO_HOME_DELAY0); fresh_from_reset = reset_game_from_home(env, env.console, context); diff --git a/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_UnownFinder.cpp b/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_UnownFinder.cpp index 4f351572bb..e69861e9de 100644 --- a/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_UnownFinder.cpp +++ b/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_UnownFinder.cpp @@ -188,17 +188,15 @@ void UnownFinder::program(SingleSwitchProgramEnvironment& env, ProControllerCont run_iteration(env, context, fresh_from_reset); }catch (OperationFailedExceptionWithScreenshot& e){ stats.errors++; - send_program_recoverable_error_notification(env, NOTIFICATION_ERROR_RECOVERABLE, e.message(), *e.screenshot()); - if (e.error_report_mode() == ErrorReport::SEND_ERROR_REPORT){ - PokemonAutomation::report_error( - &env.logger(), - env.program_info(), - "Recoverable: OperationFailedExceptionWithScreenshot", - {{"Message:", e.message()}}, - *e.screenshot(), - &e.video_stream()->history() - ); - } + send_program_recoverable_error_notification_and_telemetry_report( + env, &env.logger(), env.program_info(), + NOTIFICATION_ERROR_RECOVERABLE, + e.error_report_mode(), + e.message(), + "OperationFailedExceptionWithScreenshot", + *e.screenshot(), + &e.video_stream()->history() + ); pbf_press_button(context, BUTTON_HOME, 160ms, GameSettings::instance().GAME_TO_HOME_DELAY0); fresh_from_reset = reset_game_from_home( diff --git a/SerialPrograms/Source/PokemonLGPE/Programs/ShinyHunting/PokemonLGPE_LegendaryReset.cpp b/SerialPrograms/Source/PokemonLGPE/Programs/ShinyHunting/PokemonLGPE_LegendaryReset.cpp index 2cac71fa99..6ab969d888 100644 --- a/SerialPrograms/Source/PokemonLGPE/Programs/ShinyHunting/PokemonLGPE_LegendaryReset.cpp +++ b/SerialPrograms/Source/PokemonLGPE/Programs/ShinyHunting/PokemonLGPE_LegendaryReset.cpp @@ -198,17 +198,15 @@ void LegendaryReset::program(SingleSwitchProgramEnvironment& env, CancellableSco context.wait_for_all_requests(); consecutive_failures = 0; }catch (OperationFailedExceptionWithScreenshot& e){ - send_program_recoverable_error_notification(env, NOTIFICATION_ERROR_RECOVERABLE, e.message(), *e.screenshot()); - if (e.error_report_mode() == ErrorReport::SEND_ERROR_REPORT){ - PokemonAutomation::report_error( - &env.logger(), - env.program_info(), - "Recoverable: OperationFailedExceptionWithScreenshot", - {{"Message:", e.message()}}, - *e.screenshot(), - &e.video_stream()->history() - ); - } + send_program_recoverable_error_notification_and_telemetry_report( + env, &env.logger(), env.program_info(), + NOTIFICATION_ERROR_RECOVERABLE, + e.error_report_mode(), + e.message(), + "OperationFailedExceptionWithScreenshot", + *e.screenshot(), + &e.video_stream()->history() + ); consecutive_failures++; } diff --git a/SerialPrograms/Source/PokemonLZA/Programs/ShinyHunting/PokemonLZA_BeldumHunter.cpp b/SerialPrograms/Source/PokemonLZA/Programs/ShinyHunting/PokemonLZA_BeldumHunter.cpp index cdc304a73f..6a378bb066 100644 --- a/SerialPrograms/Source/PokemonLZA/Programs/ShinyHunting/PokemonLZA_BeldumHunter.cpp +++ b/SerialPrograms/Source/PokemonLZA/Programs/ShinyHunting/PokemonLZA_BeldumHunter.cpp @@ -200,17 +200,15 @@ void BeldumHunter::program(SingleSwitchProgramEnvironment& env, ProControllerCon } }catch (OperationFailedExceptionWithScreenshot& e){ stats.errors++; - send_program_recoverable_error_notification(env, NOTIFICATION_ERROR_RECOVERABLE, e.message(), *e.screenshot()); - if (e.error_report_mode() == ErrorReport::SEND_ERROR_REPORT){ - PokemonAutomation::report_error( - &env.logger(), - env.program_info(), - "Recoverable: OperationFailedExceptionWithScreenshot", - {{"Message:", e.message()}}, - *e.screenshot(), - &e.video_stream()->history() - ); - } + send_program_recoverable_error_notification_and_telemetry_report( + env, &env.logger(), env.program_info(), + NOTIFICATION_ERROR_RECOVERABLE, + e.error_report_mode(), + e.message(), + "OperationFailedExceptionWithScreenshot", + *e.screenshot(), + &e.video_stream()->history() + ); pbf_press_button(context, BUTTON_HOME, 160ms, 3000ms); reset_game_from_home(env, env.console, context, false); diff --git a/SerialPrograms/Source/PokemonSV/Programs/Boxes/PokemonSV_BoxRoutines.cpp b/SerialPrograms/Source/PokemonSV/Programs/Boxes/PokemonSV_BoxRoutines.cpp index f69e6a8952..e5f3a28f5b 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/Boxes/PokemonSV_BoxRoutines.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/Boxes/PokemonSV_BoxRoutines.cpp @@ -290,17 +290,15 @@ void load_one_column_to_party( // Move the held column to party move_box_cursor(env.program_info(), stream, context, BoxCursorLocation::PARTY, has_clone_ride_pokemon ? 2 : 1, 0); }catch (OperationFailedExceptionWithScreenshot& e){ - send_program_recoverable_error_notification(env, notification, e.message(), *e.screenshot()); - if (e.error_report_mode() == ErrorReport::SEND_ERROR_REPORT){ - PokemonAutomation::report_error( - &env.logger(), - env.program_info(), - "Recoverable: OperationFailedExceptionWithScreenshot", - {{"Message:", e.message()}}, - *e.screenshot(), - &e.video_stream()->history() - ); - } + send_program_recoverable_error_notification_and_telemetry_report( + env, &env.logger(), env.program_info(), + notification, + e.error_report_mode(), + e.message(), + "OperationFailedExceptionWithScreenshot", + *e.screenshot(), + &e.video_stream()->history() + ); if (++fail_count == 10){ dump_image_and_throw_recoverable_exception( @@ -344,17 +342,15 @@ void unload_one_column_from_party( // Move the held column to target move_box_cursor(env.program_info(), stream, context, BoxCursorLocation::SLOTS, has_clone_ride_pokemon ? 1 : 0, column_index); }catch (OperationFailedExceptionWithScreenshot& e){ - send_program_recoverable_error_notification(env, notification, e.message(), *e.screenshot()); - if (e.error_report_mode() == ErrorReport::SEND_ERROR_REPORT){ - PokemonAutomation::report_error( - &env.logger(), - env.program_info(), - "Recoverable: OperationFailedExceptionWithScreenshot", - {{"Message:", e.message()}}, - *e.screenshot(), - &e.video_stream()->history() - ); - } + send_program_recoverable_error_notification_and_telemetry_report( + env, &env.logger(), env.program_info(), + notification, + e.error_report_mode(), + e.message(), + "OperationFailedExceptionWithScreenshot", + *e.screenshot(), + &e.video_stream()->history() + ); if (++fail_count == 10){ dump_image_and_throw_recoverable_exception( diff --git a/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_AuctionFarmer.cpp b/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_AuctionFarmer.cpp index 21fdad8548..68cdb1c811 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_AuctionFarmer.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_AuctionFarmer.cpp @@ -571,17 +571,15 @@ void AuctionFarmer::program(SingleSwitchProgramEnvironment& env, ProControllerCo move_to_auctioneer(env, context, offer); }catch (OperationFailedExceptionWithScreenshot& e){ stats.m_errors++; - send_program_recoverable_error_notification(env, NOTIFICATION_ERROR_RECOVERABLE, e.message(), *e.screenshot()); - if (e.error_report_mode() == ErrorReport::SEND_ERROR_REPORT){ - PokemonAutomation::report_error( - &env.logger(), - env.program_info(), - "Recoverable: OperationFailedExceptionWithScreenshot", - {{"Message:", e.message()}}, - *e.screenshot(), - &e.video_stream()->history() - ); - } + send_program_recoverable_error_notification_and_telemetry_report( + env, &env.logger(), env.program_info(), + NOTIFICATION_ERROR_RECOVERABLE, + e.error_report_mode(), + e.message(), + "OperationFailedExceptionWithScreenshot", + *e.screenshot(), + &e.video_stream()->history() + ); npc_tries++; // if ONE_NPC the program already tries multiple times without change to compensate for dropped inputs diff --git a/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_MaterialFarmerTools.cpp b/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_MaterialFarmerTools.cpp index b14e12119f..45024881d7 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_MaterialFarmerTools.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_MaterialFarmerTools.cpp @@ -296,17 +296,15 @@ void run_material_farmer( }catch (OperationFailedExceptionWithScreenshot& e){ stats.m_errors++; env.update_stats(); - send_program_recoverable_error_notification(env, options.NOTIFICATION_ERROR_RECOVERABLE, e.message(), *e.screenshot()); - if (e.error_report_mode() == ErrorReport::SEND_ERROR_REPORT){ - PokemonAutomation::report_error( - &env.logger(), - env.program_info(), - "Recoverable: OperationFailedExceptionWithScreenshot", - {{"Message:", e.message()}}, - *e.screenshot(), - &e.video_stream()->history() - ); - } + send_program_recoverable_error_notification_and_telemetry_report( + env, &env.logger(), env.program_info(), + options.NOTIFICATION_ERROR_RECOVERABLE, + e.error_report_mode(), + e.message(), + "OperationFailedExceptionWithScreenshot", + *e.screenshot(), + &e.video_stream()->history() + ); // save screenshot after operation failed, // dump_snapshot(console); diff --git a/SerialPrograms/Source/PokemonSV/Programs/Glitches/PokemonSV_CloneItems-1.0.1.cpp b/SerialPrograms/Source/PokemonSV/Programs/Glitches/PokemonSV_CloneItems-1.0.1.cpp index 889e71c324..214d3ec824 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/Glitches/PokemonSV_CloneItems-1.0.1.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/Glitches/PokemonSV_CloneItems-1.0.1.cpp @@ -185,17 +185,15 @@ bool CloneItems101::clone_item(ProgramEnvironment& env, VideoStream& stream, Pro pbf_press_button(context, BUTTON_A, 160ms, 160ms); } }catch (OperationFailedExceptionWithScreenshot& e){ - send_program_recoverable_error_notification(env, NOTIFICATION_ERROR_RECOVERABLE, e.message(), *e.screenshot()); - if (e.error_report_mode() == ErrorReport::SEND_ERROR_REPORT){ - PokemonAutomation::report_error( - &env.logger(), - env.program_info(), - "Recoverable: OperationFailedExceptionWithScreenshot", - {{"Message:", e.message()}}, - *e.screenshot(), - &e.video_stream()->history() - ); - } + send_program_recoverable_error_notification_and_telemetry_report( + env, &env.logger(), env.program_info(), + NOTIFICATION_ERROR_RECOVERABLE, + e.error_report_mode(), + e.message(), + "OperationFailedExceptionWithScreenshot", + *e.screenshot(), + &e.video_stream()->history() + ); } continue; case 2: @@ -297,17 +295,15 @@ void CloneItems101::program(SingleSwitchProgramEnvironment& env, ProControllerCo stats.m_cloned++; continue; }catch (OperationFailedExceptionWithScreenshot& e){ - send_program_recoverable_error_notification(env, NOTIFICATION_ERROR_RECOVERABLE, e.message(), *e.screenshot()); - if (e.error_report_mode() == ErrorReport::SEND_ERROR_REPORT){ - PokemonAutomation::report_error( - &env.logger(), - env.program_info(), - "Recoverable: OperationFailedExceptionWithScreenshot", - {{"Message:", e.message()}}, - *e.screenshot(), - &e.video_stream()->history() - ); - } + send_program_recoverable_error_notification_and_telemetry_report( + env, &env.logger(), env.program_info(), + NOTIFICATION_ERROR_RECOVERABLE, + e.error_report_mode(), + e.message(), + "OperationFailedExceptionWithScreenshot", + *e.screenshot(), + &e.video_stream()->history() + ); } #endif diff --git a/SerialPrograms/Source/PokemonSV/Programs/Glitches/PokemonSV_RideCloner-1.0.1.cpp b/SerialPrograms/Source/PokemonSV/Programs/Glitches/PokemonSV_RideCloner-1.0.1.cpp index 73d5bfbb4b..7950996c01 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/Glitches/PokemonSV_RideCloner-1.0.1.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/Glitches/PokemonSV_RideCloner-1.0.1.cpp @@ -388,17 +388,15 @@ bool RideCloner101::run_post_win( pbf_press_button(context, BUTTON_B, 160ms, 1840ms); } }catch (OperationFailedExceptionWithScreenshot& e){ - send_program_recoverable_error_notification(env, NOTIFICATION_ERROR_RECOVERABLE, e.message(), *e.screenshot()); - if (e.error_report_mode() == ErrorReport::SEND_ERROR_REPORT){ - PokemonAutomation::report_error( - &env.logger(), - env.program_info(), - "Recoverable: OperationFailedExceptionWithScreenshot", - {{"Message:", e.message()}}, - *e.screenshot(), - &e.video_stream()->history() - ); - } + send_program_recoverable_error_notification_and_telemetry_report( + env, &env.logger(), env.program_info(), + NOTIFICATION_ERROR_RECOVERABLE, + e.error_report_mode(), + e.message(), + "OperationFailedExceptionWithScreenshot", + *e.screenshot(), + &e.video_stream()->history() + ); } continue; case 7: diff --git a/SerialPrograms/Source/PokemonSV/Programs/ShinyHunting/PokemonSV_ShinyHunt-AreaZeroPlatform.cpp b/SerialPrograms/Source/PokemonSV/Programs/ShinyHunting/PokemonSV_ShinyHunt-AreaZeroPlatform.cpp index e6628e5974..439b4951b9 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/ShinyHunting/PokemonSV_ShinyHunt-AreaZeroPlatform.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/ShinyHunting/PokemonSV_ShinyHunt-AreaZeroPlatform.cpp @@ -463,17 +463,15 @@ void ShinyHuntAreaZeroPlatform::set_flags_and_run_state( stats.m_errors++; m_env->update_stats(); m_consecutive_failures++; - send_program_recoverable_error_notification(env, NOTIFICATION_ERROR_RECOVERABLE, e.message(), *e.screenshot()); - if (e.error_report_mode() == ErrorReport::SEND_ERROR_REPORT){ - PokemonAutomation::report_error( - &env.logger(), - env.program_info(), - "Recoverable: OperationFailedExceptionWithScreenshot", - {{"Message:", e.message()}}, - *e.screenshot(), - &e.video_stream()->history() - ); - } + send_program_recoverable_error_notification_and_telemetry_report( + env, &env.logger(), env.program_info(), + NOTIFICATION_ERROR_RECOVERABLE, + e.error_report_mode(), + e.message(), + "OperationFailedExceptionWithScreenshot", + *e.screenshot(), + &e.video_stream()->history() + ); if (m_consecutive_failures >= 3){ throw_and_log( stream.logger(), diff --git a/SerialPrograms/Source/PokemonSV/Programs/ShinyHunting/PokemonSV_ShinyHunt-Scatterbug.cpp b/SerialPrograms/Source/PokemonSV/Programs/ShinyHunting/PokemonSV_ShinyHunt-Scatterbug.cpp index dd845573fe..a83c285aa3 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/ShinyHunting/PokemonSV_ShinyHunt-Scatterbug.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/ShinyHunting/PokemonSV_ShinyHunt-Scatterbug.cpp @@ -191,17 +191,15 @@ void ShinyHuntScatterbug::program(SingleSwitchProgramEnvironment& env, ProContro }catch (OperationFailedExceptionWithScreenshot& e){ stats.m_errors++; env.update_stats(); - send_program_recoverable_error_notification(env, NOTIFICATION_ERROR_RECOVERABLE, e.message(), *e.screenshot()); - if (e.error_report_mode() == ErrorReport::SEND_ERROR_REPORT){ - PokemonAutomation::report_error( - &env.logger(), - env.program_info(), - "Recoverable: OperationFailedExceptionWithScreenshot", - {{"Message:", e.message()}}, - *e.screenshot(), - &e.video_stream()->history() - ); - } + send_program_recoverable_error_notification_and_telemetry_report( + env, &env.logger(), env.program_info(), + NOTIFICATION_ERROR_RECOVERABLE, + e.error_report_mode(), + e.message(), + "OperationFailedExceptionWithScreenshot", + *e.screenshot(), + &e.video_stream()->history() + ); if (SAVE_DEBUG_VIDEO){ // Take a video to give more context for debugging diff --git a/SerialPrograms/Source/PokemonSV/Programs/TeraRaids/PokemonSV_AutoHost.cpp b/SerialPrograms/Source/PokemonSV/Programs/TeraRaids/PokemonSV_AutoHost.cpp index 8de8575a48..1d34544a66 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/TeraRaids/PokemonSV_AutoHost.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/TeraRaids/PokemonSV_AutoHost.cpp @@ -323,17 +323,15 @@ void AutoHost::program(SingleSwitchProgramEnvironment& env, ProControllerContext connect_to_internet_from_overworld(env.program_info(), env.console, context); }catch (OperationFailedExceptionWithScreenshot& e){ stats.m_errors++; - send_program_recoverable_error_notification(env, NOTIFICATION_ERROR_RECOVERABLE, e.message(), *e.screenshot()); - if (e.error_report_mode() == ErrorReport::SEND_ERROR_REPORT){ - PokemonAutomation::report_error( - &env.logger(), - env.program_info(), - "Recoverable: OperationFailedExceptionWithScreenshot", - {{"Message:", e.message()}}, - *e.screenshot(), - &e.video_stream()->history() - ); - } + send_program_recoverable_error_notification_and_telemetry_report( + env, &env.logger(), env.program_info(), + NOTIFICATION_ERROR_RECOVERABLE, + e.error_report_mode(), + e.message(), + "OperationFailedExceptionWithScreenshot", + *e.screenshot(), + &e.video_stream()->history() + ); fail_tracker.report_raid_error(); continue; } @@ -354,17 +352,15 @@ void AutoHost::program(SingleSwitchProgramEnvironment& env, ProControllerContext open_hosting_lobby(env, env.console, context, mode); }catch (OperationFailedExceptionWithScreenshot& e){ stats.m_errors++; - send_program_recoverable_error_notification(env, NOTIFICATION_ERROR_RECOVERABLE, e.message(), *e.screenshot()); - if (e.error_report_mode() == ErrorReport::SEND_ERROR_REPORT){ - PokemonAutomation::report_error( - &env.logger(), - env.program_info(), - "Recoverable: OperationFailedExceptionWithScreenshot", - {{"Message:", e.message()}}, - *e.screenshot(), - &e.video_stream()->history() - ); - } + send_program_recoverable_error_notification_and_telemetry_report( + env, &env.logger(), env.program_info(), + NOTIFICATION_ERROR_RECOVERABLE, + e.error_report_mode(), + e.message(), + "OperationFailedExceptionWithScreenshot", + *e.screenshot(), + &e.video_stream()->history() + ); fail_tracker.report_raid_error(); continue; } @@ -404,17 +400,15 @@ void AutoHost::program(SingleSwitchProgramEnvironment& env, ProControllerContext fail_tracker.report_successful_raid(); }catch (OperationFailedExceptionWithScreenshot& e){ stats.m_errors++; - send_program_recoverable_error_notification(env, NOTIFICATION_ERROR_RECOVERABLE, e.message(), *e.screenshot()); - if (e.error_report_mode() == ErrorReport::SEND_ERROR_REPORT){ - PokemonAutomation::report_error( - &env.logger(), - env.program_info(), - "Recoverable: OperationFailedExceptionWithScreenshot", - {{"Message:", e.message()}}, - *e.screenshot(), - &e.video_stream()->history() - ); - } + send_program_recoverable_error_notification_and_telemetry_report( + env, &env.logger(), env.program_info(), + NOTIFICATION_ERROR_RECOVERABLE, + e.error_report_mode(), + e.message(), + "OperationFailedExceptionWithScreenshot", + *e.screenshot(), + &e.video_stream()->history() + ); fail_tracker.report_raid_error(); continue; } diff --git a/SerialPrograms/Source/PokemonSV/Programs/TeraRaids/PokemonSV_TeraMultiFarmer.cpp b/SerialPrograms/Source/PokemonSV/Programs/TeraRaids/PokemonSV_TeraMultiFarmer.cpp index 48ebc6b0df..7c13e927e9 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/TeraRaids/PokemonSV_TeraMultiFarmer.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/TeraRaids/PokemonSV_TeraMultiFarmer.cpp @@ -621,17 +621,15 @@ void TeraMultiFarmer::program(MultiSwitchProgramEnvironment& env, CancellableSco }catch (OperationFailedExceptionWithScreenshot& e){ // cout << "caught: TeraMultiFarmer::program" << endl; - send_program_recoverable_error_notification(env, NOTIFICATION_ERROR_RECOVERABLE, e.message(), *e.screenshot()); - if (e.error_report_mode() == ErrorReport::SEND_ERROR_REPORT){ - PokemonAutomation::report_error( - &env.logger(), - env.program_info(), - "Recoverable: OperationFailedExceptionWithScreenshot", - {{"Message:", e.message()}}, - *e.screenshot(), - &e.video_stream()->history() - ); - } + send_program_recoverable_error_notification_and_telemetry_report( + env, &env.logger(), env.program_info(), + NOTIFICATION_ERROR_RECOVERABLE, + e.error_report_mode(), + e.message(), + "OperationFailedExceptionWithScreenshot", + *e.screenshot(), + &e.video_stream()->history() + ); if (RECOVERY_MODE != RecoveryMode::SAVE_AND_RESET){ // Iterate the errored Switches. If a non-host has errored, // rethrow the exception to stop the program. diff --git a/SerialPrograms/Source/PokemonSwSh/Programs/EggPrograms/PokemonSwSh_EggAutonomous.cpp b/SerialPrograms/Source/PokemonSwSh/Programs/EggPrograms/PokemonSwSh_EggAutonomous.cpp index 56e3dce7ab..1579229932 100644 --- a/SerialPrograms/Source/PokemonSwSh/Programs/EggPrograms/PokemonSwSh_EggAutonomous.cpp +++ b/SerialPrograms/Source/PokemonSwSh/Programs/EggPrograms/PokemonSwSh_EggAutonomous.cpp @@ -279,17 +279,15 @@ void EggAutonomous::program(SingleSwitchProgramEnvironment& env, ProControllerCo }catch (OperationFailedExceptionWithScreenshot& e){ stats.m_errors++; env.update_stats(); - send_program_recoverable_error_notification(env, NOTIFICATION_ERROR_RECOVERABLE, e.message(), *e.screenshot()); - if (e.error_report_mode() == ErrorReport::SEND_ERROR_REPORT){ - PokemonAutomation::report_error( - &env.logger(), - env.program_info(), - "Recoverable: OperationFailedExceptionWithScreenshot", - {{"Message:", e.message()}}, - *e.screenshot(), - &e.video_stream()->history() - ); - } + send_program_recoverable_error_notification_and_telemetry_report( + env, &env.logger(), env.program_info(), + NOTIFICATION_ERROR_RECOVERABLE, + e.error_report_mode(), + e.message(), + "OperationFailedExceptionWithScreenshot", + *e.screenshot(), + &e.video_stream()->history() + ); if (SAVE_DEBUG_VIDEO){ // Take a video to give more context for debugging From 234ad28316afad36364d880ba6b25af507f8dcb1 Mon Sep 17 00:00:00 2001 From: jw098 Date: Thu, 27 Aug 2026 23:53:03 -0700 Subject: [PATCH 12/15] clean up header --- ...OperationFailedExceptionWithScreenshot.cpp | 3 -- .../Framework/ComputerProgramSession.cpp | 1 - ...ntendoSwitch_MultiSwitchProgramSession.cpp | 1 - ...tendoSwitch_SingleSwitchProgramSession.cpp | 1 - .../PokemonBDSP_ShinyHunt-Overworld.cpp | 1 - .../Farming/PokemonLA_LeapGrinder.cpp | 1 - .../PokemonLA_NuggetFarmerHighlands.cpp | 1 - .../General/PokemonLA_RamanasIslandCombee.cpp | 1 - .../ShinyHunting/PokemonLA_BurmyFinder.cpp | 1 - .../ShinyHunting/PokemonLA_CrobatFinder.cpp | 1 - .../ShinyHunting/PokemonLA_FroslassFinder.cpp | 2 +- .../ShinyHunting/PokemonLA_GalladeFinder.cpp | 2 +- .../PokemonLA_PostMMOSpawnReset.cpp | 2 +- .../PokemonLA_ShinyHunt-CustomPath.cpp | 2 +- .../PokemonLA_ShinyHunt-FlagPin.cpp | 1 - .../ShinyHunting/PokemonLA_UnownFinder.cpp | 2 +- .../PokemonLGPE_LegendaryReset.cpp | 1 - .../ShinyHunting/PokemonLZA_BeldumHunter.cpp | 1 - .../AutoStory/PokemonSV_AutoStoryTools.cpp | 37 +++++++++---------- .../Programs/Boxes/PokemonSV_BoxRoutines.cpp | 1 - .../Programs/Eggs/PokemonSV_EggAutonomous.cpp | 15 ++++---- .../Farming/PokemonSV_AuctionFarmer.cpp | 1 - .../Farming/PokemonSV_MaterialFarmerTools.cpp | 1 - .../Glitches/PokemonSV_CloneItems-1.0.1.cpp | 1 - .../Glitches/PokemonSV_RideCloner-1.0.1.cpp | 1 - .../PokemonSV_ShinyHunt-AreaZeroPlatform.cpp | 1 - .../PokemonSV_ShinyHunt-Scatterbug.cpp | 1 - .../Programs/TeraRaids/PokemonSV_AutoHost.cpp | 1 - .../TeraRaids/PokemonSV_TeraMultiFarmer.cpp | 1 - .../EggPrograms/PokemonSwSh_EggAutonomous.cpp | 1 - 30 files changed, 30 insertions(+), 57 deletions(-) diff --git a/SerialPrograms/Source/CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.cpp b/SerialPrograms/Source/CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.cpp index 523c3d821b..df4301780c 100644 --- a/SerialPrograms/Source/CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.cpp +++ b/SerialPrograms/Source/CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.cpp @@ -5,11 +5,8 @@ */ #include "CommonFramework/ImageTypes/ImageRGB32.h" -#include "CommonFramework/ErrorReports/ErrorReports.h" -#include "CommonFramework/Notifications/ProgramNotifications.h" #include "CommonFramework/VideoPipeline/VideoFeed.h" #include "CommonFramework/Tools/VideoStream.h" -#include "CommonFramework/Tools/ProgramEnvironment.h" #include "OperationFailedExceptionWithScreenshot.h" //#include diff --git a/SerialPrograms/Source/ComputerPrograms/Framework/ComputerProgramSession.cpp b/SerialPrograms/Source/ComputerPrograms/Framework/ComputerProgramSession.cpp index 2ea6b380ab..e84a7d60b1 100644 --- a/SerialPrograms/Source/ComputerPrograms/Framework/ComputerProgramSession.cpp +++ b/SerialPrograms/Source/ComputerPrograms/Framework/ComputerProgramSession.cpp @@ -6,7 +6,6 @@ #include "Common/Cpp/Exceptions.h" #include "Common/Cpp/CancellableScope.h" -#include "CommonFramework/ErrorReports/ErrorReports.h" #include "CommonFramework/Exceptions/FatalProgramException.h" #include "CommonFramework/Exceptions/ProgramFinishedException.h" #include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" diff --git a/SerialPrograms/Source/NintendoSwitch/Framework/NintendoSwitch_MultiSwitchProgramSession.cpp b/SerialPrograms/Source/NintendoSwitch/Framework/NintendoSwitch_MultiSwitchProgramSession.cpp index 214cc409d2..f32f03df0c 100644 --- a/SerialPrograms/Source/NintendoSwitch/Framework/NintendoSwitch_MultiSwitchProgramSession.cpp +++ b/SerialPrograms/Source/NintendoSwitch/Framework/NintendoSwitch_MultiSwitchProgramSession.cpp @@ -8,7 +8,6 @@ #include "Common/Cpp/EarlyShutdown.h" #include "Common/Cpp/Concurrency/SpinPause.h" #include "Common/Cpp/Containers/FixedLimitVector.tpp" -#include "CommonFramework/ErrorReports/ErrorReports.h" #include "CommonFramework/GlobalSettingsPanel.h" #include "CommonFramework/Exceptions/FatalProgramException.h" #include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" diff --git a/SerialPrograms/Source/NintendoSwitch/Framework/NintendoSwitch_SingleSwitchProgramSession.cpp b/SerialPrograms/Source/NintendoSwitch/Framework/NintendoSwitch_SingleSwitchProgramSession.cpp index 8916dd8f77..8767f28471 100644 --- a/SerialPrograms/Source/NintendoSwitch/Framework/NintendoSwitch_SingleSwitchProgramSession.cpp +++ b/SerialPrograms/Source/NintendoSwitch/Framework/NintendoSwitch_SingleSwitchProgramSession.cpp @@ -7,7 +7,6 @@ #include "Common/Cpp/Exceptions.h" #include "Common/Cpp/EarlyShutdown.h" #include "Common/Cpp/Concurrency/SpinPause.h" -#include "CommonFramework/ErrorReports/ErrorReports.h" #include "CommonFramework/GlobalSettingsPanel.h" #include "CommonFramework/Exceptions/FatalProgramException.h" #include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" diff --git a/SerialPrograms/Source/PokemonBDSP/Programs/ShinyHunting/PokemonBDSP_ShinyHunt-Overworld.cpp b/SerialPrograms/Source/PokemonBDSP/Programs/ShinyHunting/PokemonBDSP_ShinyHunt-Overworld.cpp index 0f0e2c9aca..c2eb08db10 100644 --- a/SerialPrograms/Source/PokemonBDSP/Programs/ShinyHunting/PokemonBDSP_ShinyHunt-Overworld.cpp +++ b/SerialPrograms/Source/PokemonBDSP/Programs/ShinyHunting/PokemonBDSP_ShinyHunt-Overworld.cpp @@ -4,7 +4,6 @@ * */ -#include "CommonFramework/ErrorReports/ErrorReports.h" #include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/Notifications/ProgramNotifications.h" #include "NintendoSwitch/NintendoSwitch_Settings.h" diff --git a/SerialPrograms/Source/PokemonLA/Programs/Farming/PokemonLA_LeapGrinder.cpp b/SerialPrograms/Source/PokemonLA/Programs/Farming/PokemonLA_LeapGrinder.cpp index c8c084dcb8..dfe373948c 100644 --- a/SerialPrograms/Source/PokemonLA/Programs/Farming/PokemonLA_LeapGrinder.cpp +++ b/SerialPrograms/Source/PokemonLA/Programs/Farming/PokemonLA_LeapGrinder.cpp @@ -5,7 +5,6 @@ */ #include "Common/Cpp/PrettyPrint.h" -#include "CommonFramework/ErrorReports/ErrorReports.h" #include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/Notifications/ProgramNotifications.h" #include "CommonFramework/ProgramStats/StatsTracking.h" diff --git a/SerialPrograms/Source/PokemonLA/Programs/Farming/PokemonLA_NuggetFarmerHighlands.cpp b/SerialPrograms/Source/PokemonLA/Programs/Farming/PokemonLA_NuggetFarmerHighlands.cpp index f8ec60def8..ca908c98d6 100644 --- a/SerialPrograms/Source/PokemonLA/Programs/Farming/PokemonLA_NuggetFarmerHighlands.cpp +++ b/SerialPrograms/Source/PokemonLA/Programs/Farming/PokemonLA_NuggetFarmerHighlands.cpp @@ -4,7 +4,6 @@ * */ -#include "CommonFramework/ErrorReports/ErrorReports.h" #include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/Notifications/ProgramNotifications.h" #include "CommonFramework/ProgramStats/StatsTracking.h" diff --git a/SerialPrograms/Source/PokemonLA/Programs/General/PokemonLA_RamanasIslandCombee.cpp b/SerialPrograms/Source/PokemonLA/Programs/General/PokemonLA_RamanasIslandCombee.cpp index af861a2e99..3e43649a7b 100644 --- a/SerialPrograms/Source/PokemonLA/Programs/General/PokemonLA_RamanasIslandCombee.cpp +++ b/SerialPrograms/Source/PokemonLA/Programs/General/PokemonLA_RamanasIslandCombee.cpp @@ -6,7 +6,6 @@ #include "CommonFramework/StaticGlobals.h" #include "CommonFramework/Exceptions/ProgramFinishedException.h" -#include "CommonFramework/ErrorReports/ErrorReports.h" #include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/Notifications/ProgramNotifications.h" #include "CommonFramework/ProgramStats/StatsTracking.h" diff --git a/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_BurmyFinder.cpp b/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_BurmyFinder.cpp index 2751d54b3f..c5880b8ce4 100644 --- a/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_BurmyFinder.cpp +++ b/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_BurmyFinder.cpp @@ -8,7 +8,6 @@ #include #include "Common/Cpp/PrettyPrint.h" #include "CommonFramework/StaticGlobals.h" -#include "CommonFramework/ErrorReports/ErrorReports.h" #include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/Notifications/ProgramNotifications.h" #include "CommonFramework/ProgramStats/StatsTracking.h" diff --git a/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_CrobatFinder.cpp b/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_CrobatFinder.cpp index 78fe96a725..785b363e9c 100644 --- a/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_CrobatFinder.cpp +++ b/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_CrobatFinder.cpp @@ -4,7 +4,6 @@ * */ -#include "CommonFramework/ErrorReports/ErrorReports.h" #include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/Notifications/ProgramNotifications.h" #include "CommonFramework/ProgramStats/StatsTracking.h" diff --git a/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_FroslassFinder.cpp b/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_FroslassFinder.cpp index c5a8a6c656..43ed01a00b 100644 --- a/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_FroslassFinder.cpp +++ b/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_FroslassFinder.cpp @@ -4,8 +4,8 @@ * */ -#include "CommonFramework/ErrorReports/ErrorReports.h" #include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" +#include "CommonFramework/ImageTypes/ImageRGB32.h" #include "CommonFramework/Notifications/ProgramNotifications.h" #include "CommonFramework/ProgramStats/StatsTracking.h" #include "CommonTools/Async/InferenceRoutines.h" diff --git a/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_GalladeFinder.cpp b/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_GalladeFinder.cpp index 6d95f8ef92..4318ed16b1 100644 --- a/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_GalladeFinder.cpp +++ b/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_GalladeFinder.cpp @@ -4,8 +4,8 @@ * */ -#include "CommonFramework/ErrorReports/ErrorReports.h" #include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" +#include "CommonFramework/ImageTypes/ImageRGB32.h" #include "CommonFramework/Notifications/ProgramNotifications.h" #include "CommonFramework/ProgramStats/StatsTracking.h" #include "CommonTools/Async/InferenceRoutines.h" diff --git a/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_PostMMOSpawnReset.cpp b/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_PostMMOSpawnReset.cpp index ed03b8ba96..390417839e 100644 --- a/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_PostMMOSpawnReset.cpp +++ b/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_PostMMOSpawnReset.cpp @@ -4,8 +4,8 @@ * */ -#include "CommonFramework/ErrorReports/ErrorReports.h" #include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" +#include "CommonFramework/ImageTypes/ImageRGB32.h" #include "CommonFramework/Notifications/ProgramNotifications.h" #include "CommonFramework/ProgramStats/StatsTracking.h" #include "CommonTools/Async/InferenceRoutines.h" diff --git a/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_ShinyHunt-CustomPath.cpp b/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_ShinyHunt-CustomPath.cpp index 486f01c8e5..f97ab6d4b8 100644 --- a/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_ShinyHunt-CustomPath.cpp +++ b/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_ShinyHunt-CustomPath.cpp @@ -4,8 +4,8 @@ * */ -#include "CommonFramework/ErrorReports/ErrorReports.h" #include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" +#include "CommonFramework/ImageTypes/ImageRGB32.h" #include "CommonFramework/Notifications/ProgramNotifications.h" #include "CommonFramework/ProgramStats/StatsTracking.h" #include "CommonTools/Async/InferenceRoutines.h" diff --git a/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_ShinyHunt-FlagPin.cpp b/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_ShinyHunt-FlagPin.cpp index ea89f4aad7..6609331502 100644 --- a/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_ShinyHunt-FlagPin.cpp +++ b/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_ShinyHunt-FlagPin.cpp @@ -4,7 +4,6 @@ * */ -#include "CommonFramework/ErrorReports/ErrorReports.h" #include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/Notifications/ProgramNotifications.h" #include "CommonFramework/ProgramStats/StatsTracking.h" diff --git a/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_UnownFinder.cpp b/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_UnownFinder.cpp index e69861e9de..8f2c183b4c 100644 --- a/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_UnownFinder.cpp +++ b/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_UnownFinder.cpp @@ -4,8 +4,8 @@ * */ -#include "CommonFramework/ErrorReports/ErrorReports.h" #include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" +#include "CommonFramework/ImageTypes/ImageRGB32.h" #include "CommonFramework/Notifications/ProgramNotifications.h" #include "CommonFramework/ProgramStats/StatsTracking.h" #include "CommonTools/Async/InferenceRoutines.h" diff --git a/SerialPrograms/Source/PokemonLGPE/Programs/ShinyHunting/PokemonLGPE_LegendaryReset.cpp b/SerialPrograms/Source/PokemonLGPE/Programs/ShinyHunting/PokemonLGPE_LegendaryReset.cpp index 6ab969d888..565215c150 100644 --- a/SerialPrograms/Source/PokemonLGPE/Programs/ShinyHunting/PokemonLGPE_LegendaryReset.cpp +++ b/SerialPrograms/Source/PokemonLGPE/Programs/ShinyHunting/PokemonLGPE_LegendaryReset.cpp @@ -4,7 +4,6 @@ * */ -#include "CommonFramework/ErrorReports/ErrorReports.h" #include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/Notifications/ProgramNotifications.h" #include "CommonFramework/ProgramStats/StatsTracking.h" diff --git a/SerialPrograms/Source/PokemonLZA/Programs/ShinyHunting/PokemonLZA_BeldumHunter.cpp b/SerialPrograms/Source/PokemonLZA/Programs/ShinyHunting/PokemonLZA_BeldumHunter.cpp index 6a378bb066..5db780cb47 100644 --- a/SerialPrograms/Source/PokemonLZA/Programs/ShinyHunting/PokemonLZA_BeldumHunter.cpp +++ b/SerialPrograms/Source/PokemonLZA/Programs/ShinyHunting/PokemonLZA_BeldumHunter.cpp @@ -4,7 +4,6 @@ * */ -#include "CommonFramework/ErrorReports/ErrorReports.h" #include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/ProgramStats/StatsTracking.h" #include "CommonFramework/Notifications/ProgramNotifications.h" diff --git a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStoryTools.cpp b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStoryTools.cpp index c030912b2c..c700e043ee 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStoryTools.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStoryTools.cpp @@ -5,7 +5,6 @@ */ #include "Common/Cpp/PrettyPrint.h" -#include "CommonFramework/ErrorReports/ErrorReports.h" #include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/Exceptions/UnexpectedBattleException.h" #include "CommonFramework/Notifications/ProgramNotifications.h" @@ -506,12 +505,12 @@ void swap_starter_moves( auto snapshot = stream.video().snapshot().frame; std::string message = "swap_starter_moves: Unable to confirm that the moves actually swapped.\n" + language_warning(language); - send_program_recoverable_error_notification(env, notif_error_recoverable, message, *snapshot); - report_error( - &env.logger(), - env.program_info(), - "Recoverable: OperationFailedExceptionWithScreenshot", - {{"Message:", message}}, + send_program_recoverable_error_notification_and_telemetry_report( + env, &env.logger(), env.program_info(), + notif_error_recoverable, + ErrorReport::SEND_ERROR_REPORT, + message, + "OperationFailedExceptionWithScreenshot", *snapshot, &stream.history() ); @@ -1458,12 +1457,12 @@ void checkpoint_reattempt_loop( if (i == 10){ // send an error report for debugging if 10 failed attempts for a given checkpoint. auto snapshot = env.console.video().snapshot().frame; std::string message = "10 failed attempts. " + checkpoint_text; - send_program_recoverable_error_notification(env, notif_error_recoverable, message, *snapshot); - report_error( - &env.logger(), - env.program_info(), - "Recoverable: OperationFailedExceptionWithScreenshot", - {{"Message:", message}}, + send_program_recoverable_error_notification_and_telemetry_report( + env, &env.logger(), env.program_info(), + notif_error_recoverable, + ErrorReport::SEND_ERROR_REPORT, + message, + "OperationFailedExceptionWithScreenshot", *snapshot, &env.console.history() ); @@ -1518,12 +1517,12 @@ void checkpoint_reattempt_loop_tutorial( if (i == 10){ // send an error report for debugging if 10 failed attempts for a given checkpoint. auto snapshot = env.console.video().snapshot().frame; std::string message = "10 failed attempts. " + checkpoint_text; - send_program_recoverable_error_notification(env, notif_error_recoverable, message, *snapshot); - report_error( - &env.logger(), - env.program_info(), - "Recoverable: OperationFailedExceptionWithScreenshot", - {{"Message:", message}}, + send_program_recoverable_error_notification_and_telemetry_report( + env, &env.logger(), env.program_info(), + notif_error_recoverable, + ErrorReport::SEND_ERROR_REPORT, + message, + "OperationFailedExceptionWithScreenshot", *snapshot, &env.console.history() ); diff --git a/SerialPrograms/Source/PokemonSV/Programs/Boxes/PokemonSV_BoxRoutines.cpp b/SerialPrograms/Source/PokemonSV/Programs/Boxes/PokemonSV_BoxRoutines.cpp index e5f3a28f5b..52845f7b48 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/Boxes/PokemonSV_BoxRoutines.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/Boxes/PokemonSV_BoxRoutines.cpp @@ -7,7 +7,6 @@ //#include //#include //#include -#include "CommonFramework/ErrorReports/ErrorReports.h" #include "CommonFramework/Notifications/ProgramNotifications.h" #include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/ImageTools/ImageStats.h" diff --git a/SerialPrograms/Source/PokemonSV/Programs/Eggs/PokemonSV_EggAutonomous.cpp b/SerialPrograms/Source/PokemonSV/Programs/Eggs/PokemonSV_EggAutonomous.cpp index 0b10238bb9..47a8f664d3 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/Eggs/PokemonSV_EggAutonomous.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/Eggs/PokemonSV_EggAutonomous.cpp @@ -6,7 +6,6 @@ #include #include "CommonFramework/StaticGlobals.h" -#include "CommonFramework/ErrorReports/ErrorReports.h" #include "CommonFramework/Exceptions/ProgramFinishedException.h" #include "CommonFramework/Exceptions/FatalProgramException.h" #include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" @@ -844,15 +843,15 @@ bool EggAutonomous::handle_recoverable_error( auto snapshot = env.console.video().snapshot().frame; std::string message = fail_message; - send_program_recoverable_error_notification(env, NOTIFICATION_ERROR_RECOVERABLE, message, *snapshot); - report_error( - &env.logger(), - env.program_info(), - "Recoverable: OperationFailedExceptionWithScreenshot", - {{"Message:", message}}, + send_program_recoverable_error_notification_and_telemetry_report( + env, &env.logger(), env.program_info(), + NOTIFICATION_ERROR_RECOVERABLE, + ErrorReport::SEND_ERROR_REPORT, + message, + "OperationFailedExceptionWithScreenshot", *snapshot, &env.console.history() - ); + ); env.log("Reset game to handle recoverable error"); reset_game(env.program_info(), env.console, context); diff --git a/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_AuctionFarmer.cpp b/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_AuctionFarmer.cpp index 68cdb1c811..9645540aaf 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_AuctionFarmer.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_AuctionFarmer.cpp @@ -8,7 +8,6 @@ #include #include "CommonFramework/StaticGlobals.h" #include "CommonFramework/Exceptions/FatalProgramException.h" -#include "CommonFramework/ErrorReports/ErrorReports.h" #include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/ImageTypes/BinaryImage.h" #include "CommonFramework/Notifications/ProgramNotifications.h" diff --git a/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_MaterialFarmerTools.cpp b/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_MaterialFarmerTools.cpp index 45024881d7..607dd3fa09 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_MaterialFarmerTools.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_MaterialFarmerTools.cpp @@ -9,7 +9,6 @@ #include "Common/Cpp/PrettyPrint.h" #include "CommonFramework/StaticGlobals.h" #include "CommonFramework/Exceptions/ProgramFinishedException.h" -#include "CommonFramework/ErrorReports/ErrorReports.h" #include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/Exceptions/UnexpectedBattleException.h" #include "CommonFramework/Exceptions/FatalProgramException.h" diff --git a/SerialPrograms/Source/PokemonSV/Programs/Glitches/PokemonSV_CloneItems-1.0.1.cpp b/SerialPrograms/Source/PokemonSV/Programs/Glitches/PokemonSV_CloneItems-1.0.1.cpp index 214d3ec824..46372789dd 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/Glitches/PokemonSV_CloneItems-1.0.1.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/Glitches/PokemonSV_CloneItems-1.0.1.cpp @@ -5,7 +5,6 @@ */ #include "CommonFramework/Exceptions/FatalProgramException.h" -#include "CommonFramework/ErrorReports/ErrorReports.h" #include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/Notifications/ProgramNotifications.h" #include "CommonFramework/ProgramStats/StatsTracking.h" diff --git a/SerialPrograms/Source/PokemonSV/Programs/Glitches/PokemonSV_RideCloner-1.0.1.cpp b/SerialPrograms/Source/PokemonSV/Programs/Glitches/PokemonSV_RideCloner-1.0.1.cpp index 7950996c01..865cc51515 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/Glitches/PokemonSV_RideCloner-1.0.1.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/Glitches/PokemonSV_RideCloner-1.0.1.cpp @@ -5,7 +5,6 @@ */ #include "CommonFramework/Exceptions/FatalProgramException.h" -#include "CommonFramework/ErrorReports/ErrorReports.h" #include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/Notifications/ProgramNotifications.h" #include "CommonFramework/ProgramStats/StatsTracking.h" diff --git a/SerialPrograms/Source/PokemonSV/Programs/ShinyHunting/PokemonSV_ShinyHunt-AreaZeroPlatform.cpp b/SerialPrograms/Source/PokemonSV/Programs/ShinyHunting/PokemonSV_ShinyHunt-AreaZeroPlatform.cpp index 439b4951b9..aa2e908ade 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/ShinyHunting/PokemonSV_ShinyHunt-AreaZeroPlatform.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/ShinyHunting/PokemonSV_ShinyHunt-AreaZeroPlatform.cpp @@ -7,7 +7,6 @@ #include #include "Common/Cpp/PrettyPrint.h" #include "CommonFramework/StaticGlobals.h" -#include "CommonFramework/ErrorReports/ErrorReports.h" #include "CommonFramework/Exceptions/ProgramFinishedException.h" #include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/Exceptions/FatalProgramException.h" diff --git a/SerialPrograms/Source/PokemonSV/Programs/ShinyHunting/PokemonSV_ShinyHunt-Scatterbug.cpp b/SerialPrograms/Source/PokemonSV/Programs/ShinyHunting/PokemonSV_ShinyHunt-Scatterbug.cpp index a83c285aa3..12f301fd44 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/ShinyHunting/PokemonSV_ShinyHunt-Scatterbug.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/ShinyHunting/PokemonSV_ShinyHunt-Scatterbug.cpp @@ -8,7 +8,6 @@ #include "Common/Cpp/PrettyPrint.h" #include "CommonFramework/StaticGlobals.h" #include "CommonFramework/Exceptions/ProgramFinishedException.h" -#include "CommonFramework/ErrorReports/ErrorReports.h" #include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/Notifications/ProgramNotifications.h" #include "CommonFramework/ProgramStats/StatsTracking.h" diff --git a/SerialPrograms/Source/PokemonSV/Programs/TeraRaids/PokemonSV_AutoHost.cpp b/SerialPrograms/Source/PokemonSV/Programs/TeraRaids/PokemonSV_AutoHost.cpp index 1d34544a66..2532ce047e 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/TeraRaids/PokemonSV_AutoHost.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/TeraRaids/PokemonSV_AutoHost.cpp @@ -5,7 +5,6 @@ */ #include "Common/Cpp/PrettyPrint.h" -#include "CommonFramework/ErrorReports/ErrorReports.h" #include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/Notifications/ProgramNotifications.h" #include "CommonFramework/ProgramStats/StatsTracking.h" diff --git a/SerialPrograms/Source/PokemonSV/Programs/TeraRaids/PokemonSV_TeraMultiFarmer.cpp b/SerialPrograms/Source/PokemonSV/Programs/TeraRaids/PokemonSV_TeraMultiFarmer.cpp index 7c13e927e9..e049c0f2d8 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/TeraRaids/PokemonSV_TeraMultiFarmer.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/TeraRaids/PokemonSV_TeraMultiFarmer.cpp @@ -6,7 +6,6 @@ #include "Common/Cpp/PrettyPrint.h" //#include "CommonFramework/GlobalSettingsPanel.h" -#include "CommonFramework/ErrorReports/ErrorReports.h" #include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/ProgramStats/StatsTracking.h" #include "CommonFramework/VideoPipeline/VideoFeed.h" diff --git a/SerialPrograms/Source/PokemonSwSh/Programs/EggPrograms/PokemonSwSh_EggAutonomous.cpp b/SerialPrograms/Source/PokemonSwSh/Programs/EggPrograms/PokemonSwSh_EggAutonomous.cpp index 1579229932..a0468dfdb5 100644 --- a/SerialPrograms/Source/PokemonSwSh/Programs/EggPrograms/PokemonSwSh_EggAutonomous.cpp +++ b/SerialPrograms/Source/PokemonSwSh/Programs/EggPrograms/PokemonSwSh_EggAutonomous.cpp @@ -6,7 +6,6 @@ #include #include "CommonFramework/StaticGlobals.h" -#include "CommonFramework/ErrorReports/ErrorReports.h" #include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" #include "CommonFramework/Notifications/ProgramNotifications.h" #include "CommonFramework/ProgramStats/StatsTracking.h" From b77b7c97c60db625fb7c47875b27463cc02e1653 Mon Sep 17 00:00:00 2001 From: jw098 Date: Fri, 28 Aug 2026 17:57:02 -0700 Subject: [PATCH 13/15] add Exception member function send_fatal_error_notif_and_telemetry_report for brevity --- .../Exceptions/FatalProgramException.cpp | 81 +++++++++++++++++++ .../Exceptions/FatalProgramException.h | 39 ++++----- .../Exceptions/OperationFailedException.cpp | 55 +++++++++++++ .../Exceptions/OperationFailedException.h | 18 ++++- ...OperationFailedExceptionWithScreenshot.cpp | 33 ++++++++ .../OperationFailedExceptionWithScreenshot.h | 12 +++ .../Framework/ComputerProgramSession.cpp | 28 +------ ...ntendoSwitch_MultiSwitchProgramSession.cpp | 28 +------ ...tendoSwitch_SingleSwitchProgramSession.cpp | 28 +------ SerialPrograms/cmake/SourceFiles.cmake | 2 + 10 files changed, 220 insertions(+), 104 deletions(-) create mode 100644 SerialPrograms/Source/CommonFramework/Exceptions/FatalProgramException.cpp create mode 100644 SerialPrograms/Source/CommonFramework/Exceptions/OperationFailedException.cpp diff --git a/SerialPrograms/Source/CommonFramework/Exceptions/FatalProgramException.cpp b/SerialPrograms/Source/CommonFramework/Exceptions/FatalProgramException.cpp new file mode 100644 index 0000000000..e153192bb5 --- /dev/null +++ b/SerialPrograms/Source/CommonFramework/Exceptions/FatalProgramException.cpp @@ -0,0 +1,81 @@ +/* Fatal Program Exception + * + * From: https://github.com/PokemonAutomation/ + * + */ + +#include "CommonFramework/Notifications/ProgramNotifications.h" +#include "FatalProgramException.h" + +//#include +//using std::cout; +//using std::endl; + +namespace PokemonAutomation{ + + +FatalProgramException::FatalProgramException( + ErrorReport error_report, + std::string message +) + : m_error_report_mode(error_report) + , m_message(message) +{} + +FatalProgramException::FatalProgramException( + ErrorReport error_report, + std::string message, + VideoStream& stream +) + : m_error_report_mode(error_report) + , m_message(message) + , m_stream(&stream) + , m_screenshot(stream.video().snapshot().frame) +{} + +// Construct exception with message with screenshot and (optionally) console information. +// Use the provided screenshot instead of taking one with the console. +// Store the console information (if provided) for stream history if requested later. +FatalProgramException::FatalProgramException( + ErrorReport error_report, + std::string message, + VideoStream* stream, + ImageRGB32 screenshot +) + : m_error_report_mode(error_report) + , m_message(message) + , m_stream(stream) + , m_screenshot(std::make_shared(std::move(screenshot))) +{} + +FatalProgramException::FatalProgramException( + ErrorReport error_report, + std::string message, + VideoStream* stream, + std::shared_ptr screenshot +) + : m_error_report_mode(error_report) + , m_message(message) + , m_stream(stream) + , m_screenshot(std::move(screenshot)) +{} + + +void FatalProgramException::send_fatal_error_notif_and_telemetry_report( + ProgramEnvironment& env, + EventNotificationOption& notif_settings +){ + send_program_fatal_error_notification_and_telemetry_report( + env, &env.logger(), env.program_info(), + notif_settings, + error_report_mode(), + message(), + name(), + *m_screenshot, + &m_stream->history() + ); +} + + + +} diff --git a/SerialPrograms/Source/CommonFramework/Exceptions/FatalProgramException.h b/SerialPrograms/Source/CommonFramework/Exceptions/FatalProgramException.h index ae69b335a4..b95e14f582 100644 --- a/SerialPrograms/Source/CommonFramework/Exceptions/FatalProgramException.h +++ b/SerialPrograms/Source/CommonFramework/Exceptions/FatalProgramException.h @@ -10,6 +10,8 @@ #include "Common/Cpp/Exceptions.h" #include "CommonFramework/VideoPipeline/VideoFeed.h" #include "CommonFramework/Tools/VideoStream.h" +#include "CommonFramework/Tools/ProgramEnvironment.h" +#include "CommonFramework/Notifications/EventNotificationOption.h" namespace PokemonAutomation{ @@ -21,21 +23,13 @@ class FatalProgramException : public Exception{ explicit FatalProgramException( ErrorReport error_report, std::string message - ) - : m_error_report_mode(error_report) - , m_message(message) - {} + ); explicit FatalProgramException( ErrorReport error_report, std::string message, VideoStream& stream - ) - : m_error_report_mode(error_report) - , m_message(message) - , m_stream(&stream) - , m_screenshot(stream.video().snapshot().frame) - {} + ); // Construct exception with message with screenshot and (optionally) console information. // Use the provided screenshot instead of taking one with the console. @@ -45,26 +39,16 @@ class FatalProgramException : public Exception{ std::string message, VideoStream* stream, ImageRGB32 screenshot - ) - : m_error_report_mode(error_report) - , m_message(message) - , m_stream(stream) - , m_screenshot(std::make_shared(std::move(screenshot))) - {} + ); explicit FatalProgramException( ErrorReport error_report, std::string message, VideoStream* stream, std::shared_ptr screenshot - ) - : m_error_report_mode(error_report) - , m_message(message) - , m_stream(stream) - , m_screenshot(std::move(screenshot)) - {} - - ErrorReport error_report_mode() const { return m_error_report_mode; }; + ); + + ErrorReport error_report_mode() const { return m_error_report_mode; } virtual const char* name() const override{ return "FatalProgramException"; } ImageViewRGB32 screenshot_view() const { if (m_screenshot){ @@ -74,7 +58,12 @@ class FatalProgramException : public Exception{ } } std::shared_ptr screenshot() const {return m_screenshot;} - VideoStream* video_stream() const{return m_stream;}; + VideoStream* video_stream() const{return m_stream;} + + void send_fatal_error_notif_and_telemetry_report( + ProgramEnvironment& env, + EventNotificationOption& notif_settings + ); private: ErrorReport m_error_report_mode; diff --git a/SerialPrograms/Source/CommonFramework/Exceptions/OperationFailedException.cpp b/SerialPrograms/Source/CommonFramework/Exceptions/OperationFailedException.cpp new file mode 100644 index 0000000000..3bb97cd450 --- /dev/null +++ b/SerialPrograms/Source/CommonFramework/Exceptions/OperationFailedException.cpp @@ -0,0 +1,55 @@ +/* Operation Failed Exception + * + * From: https://github.com/PokemonAutomation/ + * + */ + +#include "CommonFramework/Notifications/ProgramNotifications.h" +#include "OperationFailedException.h" + +//#include +//using std::cout; +//using std::endl; + +namespace PokemonAutomation{ + + +OperationFailedException::OperationFailedException( + ErrorReport error_report_mode, + std::string message +) + : m_error_report_mode(error_report_mode) + , m_message(std::move(message)) +{} + + +void OperationFailedException::send_fatal_error_notif_and_telemetry_report( + ProgramEnvironment& env, + EventNotificationOption& notif_settings +){ + send_program_fatal_error_notification_and_telemetry_report( + env, &env.logger(), env.program_info(), + notif_settings, + error_report_mode(), + message(), + name() + ); +} + + +void OperationFailedException::send_recoverable_error_notif_and_telemetry_report( + ProgramEnvironment& env, + EventNotificationOption& notif_settings +){ + send_program_recoverable_error_notification_and_telemetry_report( + env, &env.logger(), env.program_info(), + notif_settings, + error_report_mode(), + message(), + name() + ); +} + + + +} diff --git a/SerialPrograms/Source/CommonFramework/Exceptions/OperationFailedException.h b/SerialPrograms/Source/CommonFramework/Exceptions/OperationFailedException.h index d1d3c7dc71..1330f54f6e 100644 --- a/SerialPrograms/Source/CommonFramework/Exceptions/OperationFailedException.h +++ b/SerialPrograms/Source/CommonFramework/Exceptions/OperationFailedException.h @@ -8,6 +8,8 @@ #define PokemonAutomation_OperationFailedException_H #include "Common/Cpp/Exceptions.h" +#include "CommonFramework/Tools/ProgramEnvironment.h" +#include "CommonFramework/Notifications/EventNotificationOption.h" namespace PokemonAutomation{ @@ -19,16 +21,24 @@ class OperationFailedException : public Exception{ OperationFailedException( ErrorReport error_report_mode, std::string message - ) - : m_error_report_mode(error_report_mode) - , m_message(std::move(message)) - {} + ); ErrorReport error_report_mode() const { return m_error_report_mode; }; virtual const char* name() const override{ return "OperationFailedException"; } virtual std::string message() const override{ return m_message; } + virtual void send_recoverable_error_notif_and_telemetry_report( + ProgramEnvironment& env, + EventNotificationOption& notif_settings + ); + + virtual void send_fatal_error_notif_and_telemetry_report( + ProgramEnvironment& env, + EventNotificationOption& notif_settings + ); + + private: ErrorReport m_error_report_mode; std::string m_message; diff --git a/SerialPrograms/Source/CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.cpp b/SerialPrograms/Source/CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.cpp index df4301780c..517d543624 100644 --- a/SerialPrograms/Source/CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.cpp +++ b/SerialPrograms/Source/CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.cpp @@ -5,6 +5,7 @@ */ #include "CommonFramework/ImageTypes/ImageRGB32.h" +#include "CommonFramework/Notifications/ProgramNotifications.h" #include "CommonFramework/VideoPipeline/VideoFeed.h" #include "CommonFramework/Tools/VideoStream.h" #include "OperationFailedExceptionWithScreenshot.h" @@ -68,6 +69,38 @@ VideoStream* OperationFailedExceptionWithScreenshot::video_stream() const{ return m_stream; } +void OperationFailedExceptionWithScreenshot::send_recoverable_error_notif_and_telemetry_report( + ProgramEnvironment& env, + EventNotificationOption& notif_settings +){ + send_program_recoverable_error_notification_and_telemetry_report( + env, &env.logger(), env.program_info(), + notif_settings, + error_report_mode(), + message(), + name(), + *m_screenshot, + &m_stream->history() + ); +} + +void OperationFailedExceptionWithScreenshot::send_fatal_error_notif_and_telemetry_report( + ProgramEnvironment& env, + EventNotificationOption& notif_settings +){ + send_program_fatal_error_notification_and_telemetry_report( + env, &env.logger(), env.program_info(), + notif_settings, + error_report_mode(), + message(), + name(), + *m_screenshot, + &m_stream->history() + ); +} + + + diff --git a/SerialPrograms/Source/CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h b/SerialPrograms/Source/CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h index f7ac248dd3..48c6711a25 100644 --- a/SerialPrograms/Source/CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h +++ b/SerialPrograms/Source/CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h @@ -9,6 +9,8 @@ #include #include "CommonFramework/Tools/VideoStream.h" +#include "CommonFramework/Tools/ProgramEnvironment.h" +#include "CommonFramework/Notifications/EventNotificationOption.h" #include "CommonFramework/Exceptions/OperationFailedException.h" #include "Common/Cpp/Exceptions.h" @@ -82,6 +84,16 @@ class OperationFailedExceptionWithScreenshot : public OperationFailedException{ std::shared_ptr screenshot() const; VideoStream* video_stream() const; + void send_recoverable_error_notif_and_telemetry_report( + ProgramEnvironment& env, + EventNotificationOption& notif_settings + ) override; + + void send_fatal_error_notif_and_telemetry_report( + ProgramEnvironment& env, + EventNotificationOption& notif_settings + ) override; + private: VideoStream* m_stream = nullptr; std::shared_ptr m_screenshot; diff --git a/SerialPrograms/Source/ComputerPrograms/Framework/ComputerProgramSession.cpp b/SerialPrograms/Source/ComputerPrograms/Framework/ComputerProgramSession.cpp index e84a7d60b1..684570cc37 100644 --- a/SerialPrograms/Source/ComputerPrograms/Framework/ComputerProgramSession.cpp +++ b/SerialPrograms/Source/ComputerPrograms/Framework/ComputerProgramSession.cpp @@ -128,15 +128,7 @@ void ComputerProgramSession::internal_run_program(){ message = e.name(); } report_error(message); - 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() - ); + e.send_fatal_error_notif_and_telemetry_report(env, m_option.instance().NOTIFICATION_ERROR_FATAL); }catch (OperationFailedException& e){ // no screenshot logger().log("Program stopped with an exception!", COLOR_RED); std::string message = e.message(); @@ -144,13 +136,7 @@ void ComputerProgramSession::internal_run_program(){ message = e.name(); } report_error(message); - 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(), - "OperationFailedException" - ); + e.send_fatal_error_notif_and_telemetry_report(env, m_option.instance().NOTIFICATION_ERROR_FATAL); }catch (FatalProgramException& e){ logger().log("Program stopped with an exception!", COLOR_RED); std::string message = e.message(); @@ -158,15 +144,7 @@ void ComputerProgramSession::internal_run_program(){ message = e.name(); } report_error(message); - 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(), - "FatalProgramException", - *e.screenshot(), - &e.video_stream()->history() - ); + e.send_fatal_error_notif_and_telemetry_report(env, m_option.instance().NOTIFICATION_ERROR_FATAL); }catch (Exception& e){ logger().log("Program stopped with an exception!", COLOR_RED); std::string message = e.message(); diff --git a/SerialPrograms/Source/NintendoSwitch/Framework/NintendoSwitch_MultiSwitchProgramSession.cpp b/SerialPrograms/Source/NintendoSwitch/Framework/NintendoSwitch_MultiSwitchProgramSession.cpp index f32f03df0c..6228ca06d8 100644 --- a/SerialPrograms/Source/NintendoSwitch/Framework/NintendoSwitch_MultiSwitchProgramSession.cpp +++ b/SerialPrograms/Source/NintendoSwitch/Framework/NintendoSwitch_MultiSwitchProgramSession.cpp @@ -258,15 +258,7 @@ void MultiSwitchProgramSession::internal_run_program(){ message = e.name(); } report_error(message); - 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() - ); + e.send_fatal_error_notif_and_telemetry_report(env, m_option.instance().NOTIFICATION_ERROR_FATAL); }catch (OperationFailedException& e){ // no screenshot logger().log("Program stopped with an exception!", COLOR_RED); env.add_overlay_log_to_all_consoles("- Program Error -", COLOR_RED); @@ -276,13 +268,7 @@ void MultiSwitchProgramSession::internal_run_program(){ message = e.name(); } report_error(message); - 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(), - "OperationFailedException" - ); + e.send_fatal_error_notif_and_telemetry_report(env, m_option.instance().NOTIFICATION_ERROR_FATAL); }catch (FatalProgramException& e){ logger().log("Program stopped with an exception!", COLOR_RED); env.add_overlay_log_to_all_consoles("- Program Error -", COLOR_RED); @@ -292,15 +278,7 @@ void MultiSwitchProgramSession::internal_run_program(){ message = e.name(); } report_error(message); - 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(), - "FatalProgramException", - *e.screenshot(), - &e.video_stream()->history() - ); + e.send_fatal_error_notif_and_telemetry_report(env, m_option.instance().NOTIFICATION_ERROR_FATAL); }catch (Exception& e){ logger().log("Program stopped with an exception!", COLOR_RED); env.add_overlay_log_to_all_consoles("- Program Error -", COLOR_RED); diff --git a/SerialPrograms/Source/NintendoSwitch/Framework/NintendoSwitch_SingleSwitchProgramSession.cpp b/SerialPrograms/Source/NintendoSwitch/Framework/NintendoSwitch_SingleSwitchProgramSession.cpp index 8767f28471..2ef67aa71a 100644 --- a/SerialPrograms/Source/NintendoSwitch/Framework/NintendoSwitch_SingleSwitchProgramSession.cpp +++ b/SerialPrograms/Source/NintendoSwitch/Framework/NintendoSwitch_SingleSwitchProgramSession.cpp @@ -222,15 +222,7 @@ void SingleSwitchProgramSession::internal_run_program(){ message = e.name(); } report_error(message); - 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() - ); + e.send_fatal_error_notif_and_telemetry_report(env, m_option.instance().NOTIFICATION_ERROR_FATAL); }catch (OperationFailedException& e){ // no screenshot logger().log("Program stopped with an exception!", COLOR_RED); env.console.overlay().add_log("- Program Error -", COLOR_RED); @@ -240,13 +232,7 @@ void SingleSwitchProgramSession::internal_run_program(){ message = e.name(); } report_error(message); - 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(), - "OperationFailedException" - ); + e.send_fatal_error_notif_and_telemetry_report(env, m_option.instance().NOTIFICATION_ERROR_FATAL); }catch (FatalProgramException& e){ logger().log("Program stopped with an exception!", COLOR_RED); env.console.overlay().add_log("- Program Error -", COLOR_RED); @@ -256,15 +242,7 @@ void SingleSwitchProgramSession::internal_run_program(){ message = e.name(); } report_error(message); - 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(), - "FatalProgramException", - *e.screenshot(), - &e.video_stream()->history() - ); + e.send_fatal_error_notif_and_telemetry_report(env, m_option.instance().NOTIFICATION_ERROR_FATAL); }catch (Exception& e){ logger().log("Program stopped with an exception!", COLOR_RED); env.console.overlay().add_log("- Program Error -", COLOR_RED); diff --git a/SerialPrograms/cmake/SourceFiles.cmake b/SerialPrograms/cmake/SourceFiles.cmake index dc1e52827b..402560515c 100644 --- a/SerialPrograms/cmake/SourceFiles.cmake +++ b/SerialPrograms/cmake/SourceFiles.cmake @@ -396,7 +396,9 @@ file(GLOB LIBRARY_SOURCES Source/CommonFramework/ErrorReports/ProgramDumper.cpp Source/CommonFramework/ErrorReports/ProgramDumper.h Source/CommonFramework/ErrorReports/ProgramDumper_Windows.tpp + Source/CommonFramework/Exceptions/FatalProgramException.cpp Source/CommonFramework/Exceptions/FatalProgramException.h + Source/CommonFramework/Exceptions/OperationFailedException.cpp Source/CommonFramework/Exceptions/OperationFailedException.h Source/CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.cpp Source/CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h From b0bac428bb79fd49c36f1ac77c9ec016d9fb470a Mon Sep 17 00:00:00 2001 From: jw098 Date: Fri, 28 Aug 2026 18:06:13 -0700 Subject: [PATCH 14/15] use e.send_recoverable_error_notif_and_telemetry_report for brevity --- .../Eggs/PokemonBDSP_EggAutonomous.cpp | 10 +------ .../PokemonBDSP_ShinyHunt-Overworld.cpp | 10 +------ .../Farming/PokemonLA_LeapGrinder.cpp | 10 +------ .../PokemonLA_NuggetFarmerHighlands.cpp | 10 +------ .../General/PokemonLA_RamanasIslandCombee.cpp | 10 +------ .../ShinyHunting/PokemonLA_BurmyFinder.cpp | 10 +------ .../ShinyHunting/PokemonLA_CrobatFinder.cpp | 10 +------ .../ShinyHunting/PokemonLA_FroslassFinder.cpp | 10 +------ .../ShinyHunting/PokemonLA_GalladeFinder.cpp | 10 +------ .../PokemonLA_PostMMOSpawnReset.cpp | 10 +------ .../PokemonLA_ShinyHunt-CustomPath.cpp | 10 +------ .../PokemonLA_ShinyHunt-FlagPin.cpp | 10 +------ .../ShinyHunting/PokemonLA_UnownFinder.cpp | 10 +------ .../PokemonLGPE_LegendaryReset.cpp | 10 +------ .../ShinyHunting/PokemonLZA_BeldumHunter.cpp | 10 +------ .../Programs/Boxes/PokemonSV_BoxRoutines.cpp | 20 ++----------- .../Farming/PokemonSV_AuctionFarmer.cpp | 10 +------ .../Farming/PokemonSV_MaterialFarmerTools.cpp | 10 +------ .../Glitches/PokemonSV_CloneItems-1.0.1.cpp | 20 ++----------- .../Glitches/PokemonSV_RideCloner-1.0.1.cpp | 10 +------ .../PokemonSV_ShinyHunt-AreaZeroPlatform.cpp | 11 ++----- .../PokemonSV_ShinyHunt-Scatterbug.cpp | 10 +------ .../Programs/TeraRaids/PokemonSV_AutoHost.cpp | 30 ++----------------- .../TeraRaids/PokemonSV_TeraMultiFarmer.cpp | 10 +------ .../EggPrograms/PokemonSwSh_EggAutonomous.cpp | 10 +------ 25 files changed, 30 insertions(+), 261 deletions(-) diff --git a/SerialPrograms/Source/PokemonBDSP/Programs/Eggs/PokemonBDSP_EggAutonomous.cpp b/SerialPrograms/Source/PokemonBDSP/Programs/Eggs/PokemonBDSP_EggAutonomous.cpp index e9394bfd9e..76c3d6ed7b 100644 --- a/SerialPrograms/Source/PokemonBDSP/Programs/Eggs/PokemonBDSP_EggAutonomous.cpp +++ b/SerialPrograms/Source/PokemonBDSP/Programs/Eggs/PokemonBDSP_EggAutonomous.cpp @@ -223,15 +223,7 @@ void EggAutonomous::program(SingleSwitchProgramEnvironment& env, ProControllerCo if (AUTO_SAVING == AutoSave::NoAutoSave){ throw; } - send_program_recoverable_error_notification_and_telemetry_report( - env, &env.logger(), env.program_info(), - NOTIFICATION_ERROR_RECOVERABLE, - e.error_report_mode(), - e.message(), - "OperationFailedExceptionWithScreenshot", - *e.screenshot(), - &e.video_stream()->history() - ); + e.send_recoverable_error_notif_and_telemetry_report(env, NOTIFICATION_ERROR_RECOVERABLE); consecutive_failures++; if (consecutive_failures >= 3){ diff --git a/SerialPrograms/Source/PokemonBDSP/Programs/ShinyHunting/PokemonBDSP_ShinyHunt-Overworld.cpp b/SerialPrograms/Source/PokemonBDSP/Programs/ShinyHunting/PokemonBDSP_ShinyHunt-Overworld.cpp index c2eb08db10..07588b62cf 100644 --- a/SerialPrograms/Source/PokemonBDSP/Programs/ShinyHunting/PokemonBDSP_ShinyHunt-Overworld.cpp +++ b/SerialPrograms/Source/PokemonBDSP/Programs/ShinyHunting/PokemonBDSP_ShinyHunt-Overworld.cpp @@ -152,15 +152,7 @@ void ShinyHuntOverworld::program(SingleSwitchProgramEnvironment& env, ProControl if (!RESET_GAME_WHEN_ERROR){ throw; } - send_program_recoverable_error_notification_and_telemetry_report( - env, &env.logger(), env.program_info(), - NOTIFICATION_ERROR_RECOVERABLE, - e.error_report_mode(), - e.message(), - "OperationFailedExceptionWithScreenshot", - *e.screenshot(), - &e.video_stream()->history() - ); + e.send_recoverable_error_notif_and_telemetry_report(env, NOTIFICATION_ERROR_RECOVERABLE); stats.add_error(); go_home(env.console, context); diff --git a/SerialPrograms/Source/PokemonLA/Programs/Farming/PokemonLA_LeapGrinder.cpp b/SerialPrograms/Source/PokemonLA/Programs/Farming/PokemonLA_LeapGrinder.cpp index dfe373948c..67fb56c1a4 100644 --- a/SerialPrograms/Source/PokemonLA/Programs/Farming/PokemonLA_LeapGrinder.cpp +++ b/SerialPrograms/Source/PokemonLA/Programs/Farming/PokemonLA_LeapGrinder.cpp @@ -313,15 +313,7 @@ void LeapGrinder::program(SingleSwitchProgramEnvironment& env, ProControllerCont } }catch (OperationFailedExceptionWithScreenshot& e){ stats.errors++; - send_program_recoverable_error_notification_and_telemetry_report( - env, &env.logger(), env.program_info(), - NOTIFICATION_ERROR_RECOVERABLE, - e.error_report_mode(), - e.message(), - "OperationFailedExceptionWithScreenshot", - *e.screenshot(), - &e.video_stream()->history() - ); + e.send_recoverable_error_notif_and_telemetry_report(env, NOTIFICATION_ERROR_RECOVERABLE); pbf_press_button(context, BUTTON_HOME, 160ms, GameSettings::instance().GAME_TO_HOME_DELAY0); fresh_from_reset = reset_game_from_home(env, env.console, context); diff --git a/SerialPrograms/Source/PokemonLA/Programs/Farming/PokemonLA_NuggetFarmerHighlands.cpp b/SerialPrograms/Source/PokemonLA/Programs/Farming/PokemonLA_NuggetFarmerHighlands.cpp index ca908c98d6..58aa8695a4 100644 --- a/SerialPrograms/Source/PokemonLA/Programs/Farming/PokemonLA_NuggetFarmerHighlands.cpp +++ b/SerialPrograms/Source/PokemonLA/Programs/Farming/PokemonLA_NuggetFarmerHighlands.cpp @@ -234,15 +234,7 @@ void NuggetFarmerHighlands::program(SingleSwitchProgramEnvironment& env, ProCont } }catch (OperationFailedExceptionWithScreenshot& e){ stats.errors++; - send_program_recoverable_error_notification_and_telemetry_report( - env, &env.logger(), env.program_info(), - NOTIFICATION_ERROR_RECOVERABLE, - e.error_report_mode(), - e.message(), - "OperationFailedExceptionWithScreenshot", - *e.screenshot(), - &e.video_stream()->history() - ); + e.send_recoverable_error_notif_and_telemetry_report(env, NOTIFICATION_ERROR_RECOVERABLE); pbf_press_button(context, BUTTON_HOME, 160ms, GameSettings::instance().GAME_TO_HOME_DELAY0); fresh_from_reset = reset_game_from_home(env, env.console, context); diff --git a/SerialPrograms/Source/PokemonLA/Programs/General/PokemonLA_RamanasIslandCombee.cpp b/SerialPrograms/Source/PokemonLA/Programs/General/PokemonLA_RamanasIslandCombee.cpp index 3e43649a7b..dc844a0be4 100644 --- a/SerialPrograms/Source/PokemonLA/Programs/General/PokemonLA_RamanasIslandCombee.cpp +++ b/SerialPrograms/Source/PokemonLA/Programs/General/PokemonLA_RamanasIslandCombee.cpp @@ -338,15 +338,7 @@ void RamanasCombeeFinder::program(SingleSwitchProgramEnvironment& env, ProContro run_iteration(env, context, fresh_from_reset); }catch (OperationFailedExceptionWithScreenshot& e){ stats.errors++; - send_program_recoverable_error_notification_and_telemetry_report( - env, &env.logger(), env.program_info(), - NOTIFICATION_ERROR_RECOVERABLE, - e.error_report_mode(), - e.message(), - "OperationFailedExceptionWithScreenshot", - *e.screenshot(), - &e.video_stream()->history() - ); + e.send_recoverable_error_notif_and_telemetry_report(env, NOTIFICATION_ERROR_RECOVERABLE); pbf_press_button(context, BUTTON_HOME, 160ms, GameSettings::instance().GAME_TO_HOME_DELAY0); fresh_from_reset = reset_game_from_home(env, env.console, context); diff --git a/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_BurmyFinder.cpp b/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_BurmyFinder.cpp index c5880b8ce4..557e994daf 100644 --- a/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_BurmyFinder.cpp +++ b/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_BurmyFinder.cpp @@ -840,15 +840,7 @@ void BurmyFinder::program(SingleSwitchProgramEnvironment& env, ProControllerCont run_iteration(env, context, counters, fresh_from_reset); }catch (OperationFailedExceptionWithScreenshot& e){ stats.errors++; - send_program_recoverable_error_notification_and_telemetry_report( - env, &env.logger(), env.program_info(), - NOTIFICATION_ERROR_RECOVERABLE, - e.error_report_mode(), - e.message(), - "OperationFailedExceptionWithScreenshot", - *e.screenshot(), - &e.video_stream()->history() - ); + e.send_recoverable_error_notif_and_telemetry_report(env, NOTIFICATION_ERROR_RECOVERABLE); pbf_press_button(context, BUTTON_HOME, 160ms, GameSettings::instance().GAME_TO_HOME_DELAY0); fresh_from_reset = reset_game_from_home( diff --git a/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_CrobatFinder.cpp b/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_CrobatFinder.cpp index 785b363e9c..43ebc44084 100644 --- a/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_CrobatFinder.cpp +++ b/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_CrobatFinder.cpp @@ -199,15 +199,7 @@ void CrobatFinder::program(SingleSwitchProgramEnvironment& env, ProControllerCon run_iteration(env, context); }catch (OperationFailedExceptionWithScreenshot& e){ stats.errors++; - send_program_recoverable_error_notification_and_telemetry_report( - env, &env.logger(), env.program_info(), - NOTIFICATION_ERROR_RECOVERABLE, - e.error_report_mode(), - e.message(), - "OperationFailedExceptionWithScreenshot", - *e.screenshot(), - &e.video_stream()->history() - ); + e.send_recoverable_error_notif_and_telemetry_report(env, NOTIFICATION_ERROR_RECOVERABLE); pbf_press_button(context, BUTTON_HOME, 160ms, GameSettings::instance().GAME_TO_HOME_DELAY0); reset_game_from_home(env, env.console, context); diff --git a/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_FroslassFinder.cpp b/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_FroslassFinder.cpp index 43ed01a00b..9ce57bedaf 100644 --- a/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_FroslassFinder.cpp +++ b/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_FroslassFinder.cpp @@ -189,15 +189,7 @@ void FroslassFinder::program(SingleSwitchProgramEnvironment& env, ProControllerC run_iteration(env, context, fresh_from_reset); }catch (OperationFailedExceptionWithScreenshot& e){ stats.errors++; - send_program_recoverable_error_notification_and_telemetry_report( - env, &env.logger(), env.program_info(), - NOTIFICATION_ERROR_RECOVERABLE, - e.error_report_mode(), - e.message(), - "OperationFailedExceptionWithScreenshot", - *e.screenshot(), - &e.video_stream()->history() - ); + e.send_recoverable_error_notif_and_telemetry_report(env, NOTIFICATION_ERROR_RECOVERABLE); pbf_press_button(context, BUTTON_HOME, 160ms, GameSettings::instance().GAME_TO_HOME_DELAY0); fresh_from_reset = reset_game_from_home( diff --git a/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_GalladeFinder.cpp b/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_GalladeFinder.cpp index 4318ed16b1..ae24af37f6 100644 --- a/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_GalladeFinder.cpp +++ b/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_GalladeFinder.cpp @@ -183,15 +183,7 @@ void GalladeFinder::program(SingleSwitchProgramEnvironment& env, ProControllerCo run_iteration(env, context); }catch (OperationFailedExceptionWithScreenshot& e){ stats.errors++; - send_program_recoverable_error_notification_and_telemetry_report( - env, &env.logger(), env.program_info(), - NOTIFICATION_ERROR_RECOVERABLE, - e.error_report_mode(), - e.message(), - "OperationFailedExceptionWithScreenshot", - *e.screenshot(), - &e.video_stream()->history() - ); + e.send_recoverable_error_notif_and_telemetry_report(env, NOTIFICATION_ERROR_RECOVERABLE); pbf_press_button(context, BUTTON_HOME, 160ms, GameSettings::instance().GAME_TO_HOME_DELAY0); reset_game_from_home(env, env.console, context); diff --git a/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_PostMMOSpawnReset.cpp b/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_PostMMOSpawnReset.cpp index 390417839e..760c05533b 100644 --- a/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_PostMMOSpawnReset.cpp +++ b/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_PostMMOSpawnReset.cpp @@ -154,15 +154,7 @@ void PostMMOSpawnReset::program(SingleSwitchProgramEnvironment& env, ProControll run_iteration(env, context); }catch (OperationFailedExceptionWithScreenshot& e){ stats.errors++; - send_program_recoverable_error_notification_and_telemetry_report( - env, &env.logger(), env.program_info(), - NOTIFICATION_ERROR_RECOVERABLE, - e.error_report_mode(), - e.message(), - "OperationFailedExceptionWithScreenshot", - *e.screenshot(), - &e.video_stream()->history() - ); + e.send_recoverable_error_notif_and_telemetry_report(env, NOTIFICATION_ERROR_RECOVERABLE); // run_iteration() restarts the game first then listens to shiny sound. // If there is any error generated when the game is running and is caught here, diff --git a/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_ShinyHunt-CustomPath.cpp b/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_ShinyHunt-CustomPath.cpp index f97ab6d4b8..b7e6a1278d 100644 --- a/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_ShinyHunt-CustomPath.cpp +++ b/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_ShinyHunt-CustomPath.cpp @@ -313,15 +313,7 @@ void ShinyHuntCustomPath::program(SingleSwitchProgramEnvironment& env, ProContro }catch (OperationFailedExceptionWithScreenshot& e){ stats.errors++; - send_program_recoverable_error_notification_and_telemetry_report( - env, &env.logger(), env.program_info(), - NOTIFICATION_ERROR_RECOVERABLE, - e.error_report_mode(), - e.message(), - "OperationFailedExceptionWithScreenshot", - *e.screenshot(), - &e.video_stream()->history() - ); + e.send_recoverable_error_notif_and_telemetry_report(env, NOTIFICATION_ERROR_RECOVERABLE); time_reset_run_count = 0; pbf_press_button(context, BUTTON_HOME, 160ms, GameSettings::instance().GAME_TO_HOME_DELAY0); diff --git a/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_ShinyHunt-FlagPin.cpp b/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_ShinyHunt-FlagPin.cpp index 6609331502..7cd8a3d750 100644 --- a/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_ShinyHunt-FlagPin.cpp +++ b/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_ShinyHunt-FlagPin.cpp @@ -201,15 +201,7 @@ void ShinyHuntFlagPin::program(SingleSwitchProgramEnvironment& env, ProControlle run_iteration(env, context, fresh_from_reset); }catch (OperationFailedExceptionWithScreenshot& e){ stats.errors++; - send_program_recoverable_error_notification_and_telemetry_report( - env, &env.logger(), env.program_info(), - NOTIFICATION_ERROR_RECOVERABLE, - e.error_report_mode(), - e.message(), - "OperationFailedExceptionWithScreenshot", - *e.screenshot(), - &e.video_stream()->history() - ); + e.send_recoverable_error_notif_and_telemetry_report(env, NOTIFICATION_ERROR_RECOVERABLE); pbf_press_button(context, BUTTON_HOME, 160ms, GameSettings::instance().GAME_TO_HOME_DELAY0); fresh_from_reset = reset_game_from_home(env, env.console, context); diff --git a/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_UnownFinder.cpp b/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_UnownFinder.cpp index 8f2c183b4c..99e8944005 100644 --- a/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_UnownFinder.cpp +++ b/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_UnownFinder.cpp @@ -188,15 +188,7 @@ void UnownFinder::program(SingleSwitchProgramEnvironment& env, ProControllerCont run_iteration(env, context, fresh_from_reset); }catch (OperationFailedExceptionWithScreenshot& e){ stats.errors++; - send_program_recoverable_error_notification_and_telemetry_report( - env, &env.logger(), env.program_info(), - NOTIFICATION_ERROR_RECOVERABLE, - e.error_report_mode(), - e.message(), - "OperationFailedExceptionWithScreenshot", - *e.screenshot(), - &e.video_stream()->history() - ); + e.send_recoverable_error_notif_and_telemetry_report(env, NOTIFICATION_ERROR_RECOVERABLE); pbf_press_button(context, BUTTON_HOME, 160ms, GameSettings::instance().GAME_TO_HOME_DELAY0); fresh_from_reset = reset_game_from_home( diff --git a/SerialPrograms/Source/PokemonLGPE/Programs/ShinyHunting/PokemonLGPE_LegendaryReset.cpp b/SerialPrograms/Source/PokemonLGPE/Programs/ShinyHunting/PokemonLGPE_LegendaryReset.cpp index 565215c150..0a67dc2915 100644 --- a/SerialPrograms/Source/PokemonLGPE/Programs/ShinyHunting/PokemonLGPE_LegendaryReset.cpp +++ b/SerialPrograms/Source/PokemonLGPE/Programs/ShinyHunting/PokemonLGPE_LegendaryReset.cpp @@ -197,15 +197,7 @@ void LegendaryReset::program(SingleSwitchProgramEnvironment& env, CancellableSco context.wait_for_all_requests(); consecutive_failures = 0; }catch (OperationFailedExceptionWithScreenshot& e){ - send_program_recoverable_error_notification_and_telemetry_report( - env, &env.logger(), env.program_info(), - NOTIFICATION_ERROR_RECOVERABLE, - e.error_report_mode(), - e.message(), - "OperationFailedExceptionWithScreenshot", - *e.screenshot(), - &e.video_stream()->history() - ); + e.send_recoverable_error_notif_and_telemetry_report(env, NOTIFICATION_ERROR_RECOVERABLE); consecutive_failures++; } diff --git a/SerialPrograms/Source/PokemonLZA/Programs/ShinyHunting/PokemonLZA_BeldumHunter.cpp b/SerialPrograms/Source/PokemonLZA/Programs/ShinyHunting/PokemonLZA_BeldumHunter.cpp index 5db780cb47..012e67b42b 100644 --- a/SerialPrograms/Source/PokemonLZA/Programs/ShinyHunting/PokemonLZA_BeldumHunter.cpp +++ b/SerialPrograms/Source/PokemonLZA/Programs/ShinyHunting/PokemonLZA_BeldumHunter.cpp @@ -199,15 +199,7 @@ void BeldumHunter::program(SingleSwitchProgramEnvironment& env, ProControllerCon } }catch (OperationFailedExceptionWithScreenshot& e){ stats.errors++; - send_program_recoverable_error_notification_and_telemetry_report( - env, &env.logger(), env.program_info(), - NOTIFICATION_ERROR_RECOVERABLE, - e.error_report_mode(), - e.message(), - "OperationFailedExceptionWithScreenshot", - *e.screenshot(), - &e.video_stream()->history() - ); + e.send_recoverable_error_notif_and_telemetry_report(env, NOTIFICATION_ERROR_RECOVERABLE); pbf_press_button(context, BUTTON_HOME, 160ms, 3000ms); reset_game_from_home(env, env.console, context, false); diff --git a/SerialPrograms/Source/PokemonSV/Programs/Boxes/PokemonSV_BoxRoutines.cpp b/SerialPrograms/Source/PokemonSV/Programs/Boxes/PokemonSV_BoxRoutines.cpp index 52845f7b48..3bd65a9b32 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/Boxes/PokemonSV_BoxRoutines.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/Boxes/PokemonSV_BoxRoutines.cpp @@ -289,15 +289,7 @@ void load_one_column_to_party( // Move the held column to party move_box_cursor(env.program_info(), stream, context, BoxCursorLocation::PARTY, has_clone_ride_pokemon ? 2 : 1, 0); }catch (OperationFailedExceptionWithScreenshot& e){ - send_program_recoverable_error_notification_and_telemetry_report( - env, &env.logger(), env.program_info(), - notification, - e.error_report_mode(), - e.message(), - "OperationFailedExceptionWithScreenshot", - *e.screenshot(), - &e.video_stream()->history() - ); + e.send_recoverable_error_notif_and_telemetry_report(env, notification); if (++fail_count == 10){ dump_image_and_throw_recoverable_exception( @@ -341,15 +333,7 @@ void unload_one_column_from_party( // Move the held column to target move_box_cursor(env.program_info(), stream, context, BoxCursorLocation::SLOTS, has_clone_ride_pokemon ? 1 : 0, column_index); }catch (OperationFailedExceptionWithScreenshot& e){ - send_program_recoverable_error_notification_and_telemetry_report( - env, &env.logger(), env.program_info(), - notification, - e.error_report_mode(), - e.message(), - "OperationFailedExceptionWithScreenshot", - *e.screenshot(), - &e.video_stream()->history() - ); + e.send_recoverable_error_notif_and_telemetry_report(env, notification); if (++fail_count == 10){ dump_image_and_throw_recoverable_exception( diff --git a/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_AuctionFarmer.cpp b/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_AuctionFarmer.cpp index 9645540aaf..0ddf930040 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_AuctionFarmer.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_AuctionFarmer.cpp @@ -570,15 +570,7 @@ void AuctionFarmer::program(SingleSwitchProgramEnvironment& env, ProControllerCo move_to_auctioneer(env, context, offer); }catch (OperationFailedExceptionWithScreenshot& e){ stats.m_errors++; - send_program_recoverable_error_notification_and_telemetry_report( - env, &env.logger(), env.program_info(), - NOTIFICATION_ERROR_RECOVERABLE, - e.error_report_mode(), - e.message(), - "OperationFailedExceptionWithScreenshot", - *e.screenshot(), - &e.video_stream()->history() - ); + e.send_recoverable_error_notif_and_telemetry_report(env, NOTIFICATION_ERROR_RECOVERABLE); npc_tries++; // if ONE_NPC the program already tries multiple times without change to compensate for dropped inputs diff --git a/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_MaterialFarmerTools.cpp b/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_MaterialFarmerTools.cpp index 607dd3fa09..b850fcd091 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_MaterialFarmerTools.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_MaterialFarmerTools.cpp @@ -295,15 +295,7 @@ void run_material_farmer( }catch (OperationFailedExceptionWithScreenshot& e){ stats.m_errors++; env.update_stats(); - send_program_recoverable_error_notification_and_telemetry_report( - env, &env.logger(), env.program_info(), - options.NOTIFICATION_ERROR_RECOVERABLE, - e.error_report_mode(), - e.message(), - "OperationFailedExceptionWithScreenshot", - *e.screenshot(), - &e.video_stream()->history() - ); + e.send_recoverable_error_notif_and_telemetry_report(env, options.NOTIFICATION_ERROR_RECOVERABLE); // save screenshot after operation failed, // dump_snapshot(console); diff --git a/SerialPrograms/Source/PokemonSV/Programs/Glitches/PokemonSV_CloneItems-1.0.1.cpp b/SerialPrograms/Source/PokemonSV/Programs/Glitches/PokemonSV_CloneItems-1.0.1.cpp index 46372789dd..192d6e2e04 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/Glitches/PokemonSV_CloneItems-1.0.1.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/Glitches/PokemonSV_CloneItems-1.0.1.cpp @@ -184,15 +184,7 @@ bool CloneItems101::clone_item(ProgramEnvironment& env, VideoStream& stream, Pro pbf_press_button(context, BUTTON_A, 160ms, 160ms); } }catch (OperationFailedExceptionWithScreenshot& e){ - send_program_recoverable_error_notification_and_telemetry_report( - env, &env.logger(), env.program_info(), - NOTIFICATION_ERROR_RECOVERABLE, - e.error_report_mode(), - e.message(), - "OperationFailedExceptionWithScreenshot", - *e.screenshot(), - &e.video_stream()->history() - ); + e.send_recoverable_error_notif_and_telemetry_report(env, NOTIFICATION_ERROR_RECOVERABLE); } continue; case 2: @@ -294,15 +286,7 @@ void CloneItems101::program(SingleSwitchProgramEnvironment& env, ProControllerCo stats.m_cloned++; continue; }catch (OperationFailedExceptionWithScreenshot& e){ - send_program_recoverable_error_notification_and_telemetry_report( - env, &env.logger(), env.program_info(), - NOTIFICATION_ERROR_RECOVERABLE, - e.error_report_mode(), - e.message(), - "OperationFailedExceptionWithScreenshot", - *e.screenshot(), - &e.video_stream()->history() - ); + e.send_recoverable_error_notif_and_telemetry_report(env, NOTIFICATION_ERROR_RECOVERABLE); } #endif diff --git a/SerialPrograms/Source/PokemonSV/Programs/Glitches/PokemonSV_RideCloner-1.0.1.cpp b/SerialPrograms/Source/PokemonSV/Programs/Glitches/PokemonSV_RideCloner-1.0.1.cpp index 865cc51515..1e82fcbbfa 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/Glitches/PokemonSV_RideCloner-1.0.1.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/Glitches/PokemonSV_RideCloner-1.0.1.cpp @@ -387,15 +387,7 @@ bool RideCloner101::run_post_win( pbf_press_button(context, BUTTON_B, 160ms, 1840ms); } }catch (OperationFailedExceptionWithScreenshot& e){ - send_program_recoverable_error_notification_and_telemetry_report( - env, &env.logger(), env.program_info(), - NOTIFICATION_ERROR_RECOVERABLE, - e.error_report_mode(), - e.message(), - "OperationFailedExceptionWithScreenshot", - *e.screenshot(), - &e.video_stream()->history() - ); + e.send_recoverable_error_notif_and_telemetry_report(env, NOTIFICATION_ERROR_RECOVERABLE); } continue; case 7: diff --git a/SerialPrograms/Source/PokemonSV/Programs/ShinyHunting/PokemonSV_ShinyHunt-AreaZeroPlatform.cpp b/SerialPrograms/Source/PokemonSV/Programs/ShinyHunting/PokemonSV_ShinyHunt-AreaZeroPlatform.cpp index aa2e908ade..362f738add 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/ShinyHunting/PokemonSV_ShinyHunt-AreaZeroPlatform.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/ShinyHunting/PokemonSV_ShinyHunt-AreaZeroPlatform.cpp @@ -462,15 +462,8 @@ void ShinyHuntAreaZeroPlatform::set_flags_and_run_state( stats.m_errors++; m_env->update_stats(); m_consecutive_failures++; - send_program_recoverable_error_notification_and_telemetry_report( - env, &env.logger(), env.program_info(), - NOTIFICATION_ERROR_RECOVERABLE, - e.error_report_mode(), - e.message(), - "OperationFailedExceptionWithScreenshot", - *e.screenshot(), - &e.video_stream()->history() - ); + e.send_recoverable_error_notif_and_telemetry_report(env, NOTIFICATION_ERROR_RECOVERABLE); + if (m_consecutive_failures >= 3){ throw_and_log( stream.logger(), diff --git a/SerialPrograms/Source/PokemonSV/Programs/ShinyHunting/PokemonSV_ShinyHunt-Scatterbug.cpp b/SerialPrograms/Source/PokemonSV/Programs/ShinyHunting/PokemonSV_ShinyHunt-Scatterbug.cpp index 12f301fd44..ba339302e5 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/ShinyHunting/PokemonSV_ShinyHunt-Scatterbug.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/ShinyHunting/PokemonSV_ShinyHunt-Scatterbug.cpp @@ -190,15 +190,7 @@ void ShinyHuntScatterbug::program(SingleSwitchProgramEnvironment& env, ProContro }catch (OperationFailedExceptionWithScreenshot& e){ stats.m_errors++; env.update_stats(); - send_program_recoverable_error_notification_and_telemetry_report( - env, &env.logger(), env.program_info(), - NOTIFICATION_ERROR_RECOVERABLE, - e.error_report_mode(), - e.message(), - "OperationFailedExceptionWithScreenshot", - *e.screenshot(), - &e.video_stream()->history() - ); + e.send_recoverable_error_notif_and_telemetry_report(env, NOTIFICATION_ERROR_RECOVERABLE); if (SAVE_DEBUG_VIDEO){ // Take a video to give more context for debugging diff --git a/SerialPrograms/Source/PokemonSV/Programs/TeraRaids/PokemonSV_AutoHost.cpp b/SerialPrograms/Source/PokemonSV/Programs/TeraRaids/PokemonSV_AutoHost.cpp index 2532ce047e..7333a75ed1 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/TeraRaids/PokemonSV_AutoHost.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/TeraRaids/PokemonSV_AutoHost.cpp @@ -322,15 +322,7 @@ void AutoHost::program(SingleSwitchProgramEnvironment& env, ProControllerContext connect_to_internet_from_overworld(env.program_info(), env.console, context); }catch (OperationFailedExceptionWithScreenshot& e){ stats.m_errors++; - send_program_recoverable_error_notification_and_telemetry_report( - env, &env.logger(), env.program_info(), - NOTIFICATION_ERROR_RECOVERABLE, - e.error_report_mode(), - e.message(), - "OperationFailedExceptionWithScreenshot", - *e.screenshot(), - &e.video_stream()->history() - ); + e.send_recoverable_error_notif_and_telemetry_report(env, NOTIFICATION_ERROR_RECOVERABLE); fail_tracker.report_raid_error(); continue; } @@ -351,15 +343,7 @@ void AutoHost::program(SingleSwitchProgramEnvironment& env, ProControllerContext open_hosting_lobby(env, env.console, context, mode); }catch (OperationFailedExceptionWithScreenshot& e){ stats.m_errors++; - send_program_recoverable_error_notification_and_telemetry_report( - env, &env.logger(), env.program_info(), - NOTIFICATION_ERROR_RECOVERABLE, - e.error_report_mode(), - e.message(), - "OperationFailedExceptionWithScreenshot", - *e.screenshot(), - &e.video_stream()->history() - ); + e.send_recoverable_error_notif_and_telemetry_report(env, NOTIFICATION_ERROR_RECOVERABLE); fail_tracker.report_raid_error(); continue; } @@ -399,15 +383,7 @@ void AutoHost::program(SingleSwitchProgramEnvironment& env, ProControllerContext fail_tracker.report_successful_raid(); }catch (OperationFailedExceptionWithScreenshot& e){ stats.m_errors++; - send_program_recoverable_error_notification_and_telemetry_report( - env, &env.logger(), env.program_info(), - NOTIFICATION_ERROR_RECOVERABLE, - e.error_report_mode(), - e.message(), - "OperationFailedExceptionWithScreenshot", - *e.screenshot(), - &e.video_stream()->history() - ); + e.send_recoverable_error_notif_and_telemetry_report(env, NOTIFICATION_ERROR_RECOVERABLE); fail_tracker.report_raid_error(); continue; } diff --git a/SerialPrograms/Source/PokemonSV/Programs/TeraRaids/PokemonSV_TeraMultiFarmer.cpp b/SerialPrograms/Source/PokemonSV/Programs/TeraRaids/PokemonSV_TeraMultiFarmer.cpp index e049c0f2d8..67a98df28d 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/TeraRaids/PokemonSV_TeraMultiFarmer.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/TeraRaids/PokemonSV_TeraMultiFarmer.cpp @@ -620,15 +620,7 @@ void TeraMultiFarmer::program(MultiSwitchProgramEnvironment& env, CancellableSco }catch (OperationFailedExceptionWithScreenshot& e){ // cout << "caught: TeraMultiFarmer::program" << endl; - send_program_recoverable_error_notification_and_telemetry_report( - env, &env.logger(), env.program_info(), - NOTIFICATION_ERROR_RECOVERABLE, - e.error_report_mode(), - e.message(), - "OperationFailedExceptionWithScreenshot", - *e.screenshot(), - &e.video_stream()->history() - ); + e.send_recoverable_error_notif_and_telemetry_report(env, NOTIFICATION_ERROR_RECOVERABLE); if (RECOVERY_MODE != RecoveryMode::SAVE_AND_RESET){ // Iterate the errored Switches. If a non-host has errored, // rethrow the exception to stop the program. diff --git a/SerialPrograms/Source/PokemonSwSh/Programs/EggPrograms/PokemonSwSh_EggAutonomous.cpp b/SerialPrograms/Source/PokemonSwSh/Programs/EggPrograms/PokemonSwSh_EggAutonomous.cpp index a0468dfdb5..f98d51ab1a 100644 --- a/SerialPrograms/Source/PokemonSwSh/Programs/EggPrograms/PokemonSwSh_EggAutonomous.cpp +++ b/SerialPrograms/Source/PokemonSwSh/Programs/EggPrograms/PokemonSwSh_EggAutonomous.cpp @@ -278,15 +278,7 @@ void EggAutonomous::program(SingleSwitchProgramEnvironment& env, ProControllerCo }catch (OperationFailedExceptionWithScreenshot& e){ stats.m_errors++; env.update_stats(); - send_program_recoverable_error_notification_and_telemetry_report( - env, &env.logger(), env.program_info(), - NOTIFICATION_ERROR_RECOVERABLE, - e.error_report_mode(), - e.message(), - "OperationFailedExceptionWithScreenshot", - *e.screenshot(), - &e.video_stream()->history() - ); + e.send_recoverable_error_notif_and_telemetry_report(env, NOTIFICATION_ERROR_RECOVERABLE); if (SAVE_DEBUG_VIDEO){ // Take a video to give more context for debugging From 656b62c42c42722c8de12d30f5a718826f78946e Mon Sep 17 00:00:00 2001 From: jw098 Date: Fri, 28 Aug 2026 18:29:53 -0700 Subject: [PATCH 15/15] cleanup headers --- .../Exceptions/FatalProgramException.cpp | 5 +++ .../Exceptions/FatalProgramException.h | 11 ++++--- .../Exceptions/OperationFailedException.cpp | 2 ++ .../Exceptions/OperationFailedException.h | 4 +-- ...OperationFailedExceptionWithScreenshot.cpp | 33 +++++++++++++++++-- .../OperationFailedExceptionWithScreenshot.h | 29 +++------------- .../Source/CommonTools/MultiConsoleErrors.cpp | 1 + 7 files changed, 53 insertions(+), 32 deletions(-) diff --git a/SerialPrograms/Source/CommonFramework/Exceptions/FatalProgramException.cpp b/SerialPrograms/Source/CommonFramework/Exceptions/FatalProgramException.cpp index e153192bb5..7c6b4ac424 100644 --- a/SerialPrograms/Source/CommonFramework/Exceptions/FatalProgramException.cpp +++ b/SerialPrograms/Source/CommonFramework/Exceptions/FatalProgramException.cpp @@ -4,6 +4,11 @@ * */ + +#include "CommonFramework/VideoPipeline/VideoFeed.h" +#include "CommonFramework/Tools/VideoStream.h" +#include "CommonFramework/Tools/ProgramEnvironment.h" +#include "CommonFramework/Notifications/EventNotificationOption.h" #include "CommonFramework/Notifications/ProgramNotifications.h" #include "FatalProgramException.h" diff --git a/SerialPrograms/Source/CommonFramework/Exceptions/FatalProgramException.h b/SerialPrograms/Source/CommonFramework/Exceptions/FatalProgramException.h index b95e14f582..73b1ffa08f 100644 --- a/SerialPrograms/Source/CommonFramework/Exceptions/FatalProgramException.h +++ b/SerialPrograms/Source/CommonFramework/Exceptions/FatalProgramException.h @@ -7,14 +7,17 @@ #ifndef PokemonAutomation_FatalProgramException_H #define PokemonAutomation_FatalProgramException_H +#include +#include "CommonFramework/ImageTypes/ImageRGB32.h" #include "Common/Cpp/Exceptions.h" -#include "CommonFramework/VideoPipeline/VideoFeed.h" -#include "CommonFramework/Tools/VideoStream.h" -#include "CommonFramework/Tools/ProgramEnvironment.h" -#include "CommonFramework/Notifications/EventNotificationOption.h" namespace PokemonAutomation{ +class VideoStream; +class ProgramEnvironment; +class EventNotificationOption; +class ImageViewRGB32; +class ImageRGB32; // A generic exception that should not be caught outside of infra. class FatalProgramException : public Exception{ diff --git a/SerialPrograms/Source/CommonFramework/Exceptions/OperationFailedException.cpp b/SerialPrograms/Source/CommonFramework/Exceptions/OperationFailedException.cpp index 3bb97cd450..21eb933a35 100644 --- a/SerialPrograms/Source/CommonFramework/Exceptions/OperationFailedException.cpp +++ b/SerialPrograms/Source/CommonFramework/Exceptions/OperationFailedException.cpp @@ -4,6 +4,8 @@ * */ +#include "CommonFramework/Tools/ProgramEnvironment.h" +#include "CommonFramework/Notifications/EventNotificationOption.h" #include "CommonFramework/Notifications/ProgramNotifications.h" #include "OperationFailedException.h" diff --git a/SerialPrograms/Source/CommonFramework/Exceptions/OperationFailedException.h b/SerialPrograms/Source/CommonFramework/Exceptions/OperationFailedException.h index 1330f54f6e..26480acdf0 100644 --- a/SerialPrograms/Source/CommonFramework/Exceptions/OperationFailedException.h +++ b/SerialPrograms/Source/CommonFramework/Exceptions/OperationFailedException.h @@ -8,11 +8,11 @@ #define PokemonAutomation_OperationFailedException_H #include "Common/Cpp/Exceptions.h" -#include "CommonFramework/Tools/ProgramEnvironment.h" -#include "CommonFramework/Notifications/EventNotificationOption.h" namespace PokemonAutomation{ +class ProgramEnvironment; +class EventNotificationOption; // Thrown by subroutines if they fail for an in-game reason. // These include recoverable errors which can be consumed by the program. diff --git a/SerialPrograms/Source/CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.cpp b/SerialPrograms/Source/CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.cpp index 517d543624..45ad5be2d7 100644 --- a/SerialPrograms/Source/CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.cpp +++ b/SerialPrograms/Source/CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.cpp @@ -5,9 +5,10 @@ */ #include "CommonFramework/ImageTypes/ImageRGB32.h" -#include "CommonFramework/Notifications/ProgramNotifications.h" #include "CommonFramework/VideoPipeline/VideoFeed.h" -#include "CommonFramework/Tools/VideoStream.h" +#include "CommonFramework/Tools/ProgramEnvironment.h" +#include "CommonFramework/Notifications/EventNotificationOption.h" +#include "CommonFramework/Notifications/ProgramNotifications.h" #include "OperationFailedExceptionWithScreenshot.h" //#include @@ -53,6 +54,34 @@ OperationFailedExceptionWithScreenshot::OperationFailedExceptionWithScreenshot( {} +[[noreturn]] void OperationFailedExceptionWithScreenshot::fire( + ErrorReport error_report, + std::string message, + VideoStream& stream +){ + throw_and_log( + stream.logger(), + error_report, + std::move(message), + stream + ); +} +[[noreturn]] void OperationFailedExceptionWithScreenshot::fire( + ErrorReport error_report, + std::string message, + VideoStream& stream, + std::shared_ptr screenshot +){ + throw_and_log( + stream.logger(), + error_report, + std::move(message), + &stream, + std::move(screenshot) + ); +} + + ImageViewRGB32 OperationFailedExceptionWithScreenshot::screenshot_view() const{ if (m_screenshot){ diff --git a/SerialPrograms/Source/CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h b/SerialPrograms/Source/CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h index 48c6711a25..eee2b3a94c 100644 --- a/SerialPrograms/Source/CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h +++ b/SerialPrograms/Source/CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h @@ -9,19 +9,15 @@ #include #include "CommonFramework/Tools/VideoStream.h" -#include "CommonFramework/Tools/ProgramEnvironment.h" -#include "CommonFramework/Notifications/EventNotificationOption.h" #include "CommonFramework/Exceptions/OperationFailedException.h" -#include "Common/Cpp/Exceptions.h" namespace PokemonAutomation{ class ImageViewRGB32; class ImageRGB32; -// class EventNotificationOption; -// class VideoStream; -// struct ProgramInfo; -// class ProgramEnvironment; +class EventNotificationOption; +class VideoStream; +class ProgramEnvironment; // Thrown by subroutines if they fail for an in-game reason. @@ -56,28 +52,13 @@ class OperationFailedExceptionWithScreenshot : public OperationFailedException{ ErrorReport error_report, std::string message, VideoStream& stream - ){ - throw_and_log( - stream.logger(), - error_report, - std::move(message), - stream - ); - } + ); [[noreturn]] static void fire( ErrorReport error_report, std::string message, VideoStream& stream, std::shared_ptr screenshot - ){ - throw_and_log( - stream.logger(), - error_report, - std::move(message), - &stream, - std::move(screenshot) - ); - } + ); virtual const char* name() const override{ return "OperationFailedExceptionWithScreenshot"; } ImageViewRGB32 screenshot_view() const; diff --git a/SerialPrograms/Source/CommonTools/MultiConsoleErrors.cpp b/SerialPrograms/Source/CommonTools/MultiConsoleErrors.cpp index 9a07bc0a4c..58a77d8925 100644 --- a/SerialPrograms/Source/CommonTools/MultiConsoleErrors.cpp +++ b/SerialPrograms/Source/CommonTools/MultiConsoleErrors.cpp @@ -5,6 +5,7 @@ */ #include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h" +#include "CommonFramework/Tools/VideoStream.h" #include "MultiConsoleErrors.h" namespace PokemonAutomation{