Added hopefully more details in image parsing errors, ref #723
This commit is contained in:
@@ -41,12 +41,12 @@ namespace lms::image::GraphicsMagick
|
||||
catch (Magick::Warning& e)
|
||||
{
|
||||
LMS_LOG(COVER, WARNING, "Caught Magick warning: " << e.what());
|
||||
throw Exception{ std::string{ "Magick read warning: " } + e.what() };
|
||||
throw Exception{ std::string{ "Read warning: " } + e.what() };
|
||||
}
|
||||
catch (Magick::Exception& e)
|
||||
{
|
||||
LMS_LOG(COVER, ERROR, "Caught Magick exception: " << e.what());
|
||||
throw Exception{ std::string{ "Magick read error: " } + e.what() };
|
||||
throw Exception{ std::string{ "Read error: " } + e.what() };
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,12 +63,12 @@ namespace lms::image::GraphicsMagick
|
||||
catch (Magick::Warning& e)
|
||||
{
|
||||
LMS_LOG(COVER, WARNING, "Caught Magick warning: " << e.what());
|
||||
throw Exception{ std::string{ "Magick read warning: " } + e.what() };
|
||||
throw Exception{ std::string{ "Read warning: " } + e.what() };
|
||||
}
|
||||
catch (Magick::Exception& e)
|
||||
{
|
||||
LMS_LOG(COVER, ERROR, "Caught Magick exception: " << e.what());
|
||||
throw Exception{ std::string{ "Magick read error: " } + e.what() };
|
||||
throw Exception{ std::string{ "Read error: " } + e.what() };
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,7 +93,7 @@ namespace lms::image::GraphicsMagick
|
||||
catch (Magick::Exception& e)
|
||||
{
|
||||
LMS_LOG(COVER, ERROR, "Caught Magick exception while resizing: " << e.what());
|
||||
throw Exception{ std::string{ "Magick resize error: " } + e.what() };
|
||||
throw Exception{ std::string{ "Resize error: " } + e.what() };
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -23,14 +23,17 @@
|
||||
|
||||
namespace lms::image
|
||||
{
|
||||
StbiException::StbiException(std::string_view desc)
|
||||
: Exception{ std::string{ desc } + ": " + getLastFailureReason() }
|
||||
namespace
|
||||
{
|
||||
}
|
||||
std::string getLastStbiFailureReason()
|
||||
{
|
||||
const char* failureReason{ ::stbi_failure_reason() };
|
||||
return failureReason ? failureReason : "unknown reason";
|
||||
}
|
||||
} // namespace
|
||||
|
||||
std::string StbiException::getLastFailureReason()
|
||||
StbiException::StbiException(std::string_view desc)
|
||||
: Exception{ std::string{ desc } + ": " + getLastStbiFailureReason() }
|
||||
{
|
||||
const char* failureReason{ ::stbi_failure_reason() };
|
||||
return failureReason ? failureReason : "unknown reason";
|
||||
}
|
||||
} // namespace lms::image
|
||||
@@ -29,8 +29,5 @@ namespace lms::image
|
||||
{
|
||||
public:
|
||||
StbiException(std::string_view desc);
|
||||
|
||||
private:
|
||||
static std::string getLastFailureReason();
|
||||
};
|
||||
} // namespace lms::image
|
||||
Reference in New Issue
Block a user