Веб-сайт самохостера Lotigara

summaryrefslogtreecommitdiff
path: root/source/core
diff options
context:
space:
mode:
Diffstat (limited to 'source/core')
-rw-r--r--source/core/StarDirectives.cpp7
-rw-r--r--source/core/StarImageProcessing.hpp6
2 files changed, 10 insertions, 3 deletions
diff --git a/source/core/StarDirectives.cpp b/source/core/StarDirectives.cpp
index 9214abf..1245eae 100644
--- a/source/core/StarDirectives.cpp
+++ b/source/core/StarDirectives.cpp
@@ -56,7 +56,7 @@ void Directives::parse(String const& directives) {
ImageOperation operation = imageOperationFromString(str);
newList.emplace_back(move(operation), move(str));
} catch (StarException const& e) {
- Logger::logf(LogLevel::Error, "Error parsing image operation: %s", e.what());
+ newList.emplace_back(ErrorImageOperation{ std::current_exception() }, move(str));
}
}
}
@@ -214,7 +214,10 @@ inline Image DirectivesGroup::applyNewImage(Image const& image) const {
void DirectivesGroup::applyExistingImage(Image& image) const {
forEach([&](auto const& entry) {
- processImageOperation(entry.operation, image);
+ if (auto error = entry.operation.ptr<ErrorImageOperation>())
+ std::rethrow_exception(error->exception);
+ else
+ processImageOperation(entry.operation, image);
});
}
diff --git a/source/core/StarImageProcessing.hpp b/source/core/StarImageProcessing.hpp
index 30640bf..ed560af 100644
--- a/source/core/StarImageProcessing.hpp
+++ b/source/core/StarImageProcessing.hpp
@@ -18,6 +18,10 @@ Image scaleBicubic(Image const& srcImage, Vec2F const& scale);
StringList colorDirectivesFromConfig(JsonArray const& directives);
String paletteSwapDirectivesFromConfig(Json const& swaps);
+struct ErrorImageOperation {
+ std::exception_ptr exception;
+};
+
struct HueShiftImageOperation {
// Specify hue shift angle as -360 to 360 rather than -1 to 1
static HueShiftImageOperation hueShiftDegrees(float degrees);
@@ -129,7 +133,7 @@ struct FlipImageOperation {
Mode mode;
};
-typedef Variant<HueShiftImageOperation, SaturationShiftImageOperation, BrightnessMultiplyImageOperation, FadeToColorImageOperation,
+typedef Variant<ErrorImageOperation, HueShiftImageOperation, SaturationShiftImageOperation, BrightnessMultiplyImageOperation, FadeToColorImageOperation,
ScanLinesImageOperation, SetColorImageOperation, ColorReplaceImageOperation, AlphaMaskImageOperation, BlendImageOperation,
MultiplyImageOperation, BorderImageOperation, ScaleImageOperation, CropImageOperation, FlipImageOperation> ImageOperation;