newsmemory-ios-sdk/Frameworks/RNReanimated.xcframework/ios-arm64/Headers/ErrorHandler.h

33 lines
648 B
C
Raw Permalink Normal View History

2024-10-29 07:36:43 +00:00
#pragma once
#include <memory>
#include <string>
#include "Scheduler.h"
namespace reanimated {
struct ErrorWrapper {
std::string message = "";
bool handled = true;
};
class ErrorHandler {
public:
bool raise() {
if (getError()->handled) {
return false;
}
this->getScheduler()->scheduleOnUI([this]() mutable { this->raiseSpec(); });
return true;
}
virtual std::shared_ptr<Scheduler> getScheduler() = 0;
virtual std::shared_ptr<ErrorWrapper> getError() = 0;
virtual void setError(std::string message) = 0;
virtual ~ErrorHandler() {}
protected:
virtual void raiseSpec() = 0;
};
} // namespace reanimated