-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
olive action failed exception (#499)
- Loading branch information
Showing
4 changed files
with
84 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
SerialPrograms/Source/CommonFramework/Exceptions/OliveActionFailedException.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* Operation Failed Exception | ||
* | ||
* From: https://github.com/PokemonAutomation/Arduino-Source | ||
* | ||
*/ | ||
|
||
#include "CommonFramework/ImageTypes/ImageRGB32.h" | ||
#include "CommonFramework/Notifications/ProgramNotifications.h" | ||
#include "CommonFramework/Tools/ErrorDumper.h" | ||
#include "CommonFramework/Tools/ProgramEnvironment.h" | ||
#include "CommonFramework/Tools/ConsoleHandle.h" | ||
#include "OliveActionFailedException.h" | ||
|
||
namespace PokemonAutomation{ | ||
|
||
|
||
OliveActionFailedException::OliveActionFailedException(ErrorReport error_report, Logger& logger, std::string message, OliveFail fail_reason) | ||
: OperationFailedException(error_report, logger, std::move(message)) | ||
, m_fail_reason(fail_reason) | ||
{} | ||
OliveActionFailedException::OliveActionFailedException(ErrorReport error_report, Logger& logger, std::string message, std::shared_ptr<const ImageRGB32> screenshot, OliveFail fail_reason) | ||
: OperationFailedException(error_report, logger, std::move(message), std::move(screenshot)) | ||
, m_fail_reason(fail_reason) | ||
{} | ||
OliveActionFailedException::OliveActionFailedException(ErrorReport error_report, ConsoleHandle& console, std::string message, bool take_screenshot, OliveFail fail_reason) | ||
: OperationFailedException(error_report, console, std::move(message), take_screenshot) | ||
, m_fail_reason(fail_reason) | ||
{} | ||
|
||
|
||
|
||
|
||
|
||
} |
46 changes: 46 additions & 0 deletions
46
SerialPrograms/Source/CommonFramework/Exceptions/OliveActionFailedException.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* Operation Failed Exception | ||
* | ||
* From: https://github.com/PokemonAutomation/Arduino-Source | ||
* | ||
*/ | ||
|
||
#ifndef PokemonAutomation_OliveActionFailedException_H | ||
#define PokemonAutomation_OliveActionFailedException_H | ||
|
||
#include <memory> | ||
#include "OperationFailedException.h" | ||
|
||
namespace PokemonAutomation{ | ||
|
||
class FatalProgramException; | ||
|
||
enum class OliveFail{ | ||
NONE, | ||
FAILED_ALIGN_TO_OLIVE, | ||
FAILED_PUSH_OLIVE_TOTAL_DISTANCE, | ||
NO_OLIVE_DETECTED, | ||
FAILED_WALK_TO_OLIVE, | ||
OLIVE_STUCK, | ||
}; | ||
|
||
// 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{ | ||
public: | ||
explicit OliveActionFailedException(ErrorReport error_report, Logger& logger, std::string message, OliveFail fail_reason = OliveFail::NONE); | ||
explicit OliveActionFailedException(ErrorReport error_report, Logger& logger, std::string message, std::shared_ptr<const ImageRGB32> screenshot, OliveFail fail_reason = OliveFail::NONE); | ||
explicit OliveActionFailedException(ErrorReport error_report, ConsoleHandle& console, std::string message, bool take_screenshot, OliveFail fail_reason = OliveFail::NONE); | ||
|
||
virtual const char* name() const override{ return "OliveActionFailedException"; } | ||
|
||
public: | ||
OliveFail m_fail_reason; | ||
|
||
}; | ||
|
||
|
||
|
||
|
||
|
||
} | ||
#endif |