summaryrefslogtreecommitdiff
path: root/indra/llimage/llpngwrapper.cpp
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2016-07-19 16:25:25 -0400
committerNat Goodspeed <nat@lindenlab.com>2016-07-19 16:25:25 -0400
commit9c49a6c91dd9b5bbe811fcd91d8992ed6bac33e7 (patch)
treeac1d2b5683b0df287448373b79092981115d9410 /indra/llimage/llpngwrapper.cpp
parent47d93e4f65493977217cfed53ff68eb926cf9bb7 (diff)
MAINT-5011: Introduce LLException base class for viewer exceptions.
This also introduces LLContinueError for exceptions which should interrupt some part of viewer processing (e.g. the current coroutine) but should attempt to let the viewer session proceed. Derive all existing viewer exception classes from LLException rather than from std::runtime_error or std::logic_error. Use BOOST_THROW_EXCEPTION() rather than plain 'throw' to enrich the thrown exception with source file, line number and containing function.
Diffstat (limited to 'indra/llimage/llpngwrapper.cpp')
-rw-r--r--indra/llimage/llpngwrapper.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/indra/llimage/llpngwrapper.cpp b/indra/llimage/llpngwrapper.cpp
index 531859cbc9..0b7d4c717f 100644
--- a/indra/llimage/llpngwrapper.cpp
+++ b/indra/llimage/llpngwrapper.cpp
@@ -31,12 +31,13 @@
#include "llimage.h"
#include "llpngwrapper.h"
-#include <stdexcept>
+#include "llexception.h"
+#include <boost/throw_exception.hpp>
namespace {
-struct PngError: public std::runtime_error
+struct PngError: public LLException
{
- PngError(png_const_charp msg): std::runtime_error(msg) {}
+ PngError(png_const_charp msg): LLException(msg) {}
};
} // anonymous namespace
@@ -87,7 +88,7 @@ BOOL LLPngWrapper::isValidPng(U8* src)
// occurs. We throw PngError and let our try/catch block clean up.
void LLPngWrapper::errorHandler(png_structp png_ptr, png_const_charp msg)
{
- throw PngError(msg);
+ BOOST_THROW_EXCEPTION(PngError(msg));
}
// Called by the libpng library when reading (decoding) the PNG file. We
@@ -137,7 +138,7 @@ BOOL LLPngWrapper::readPng(U8* src, S32 dataSize, LLImageRaw* rawImage, ImageInf
this, &errorHandler, NULL);
if (mReadPngPtr == NULL)
{
- throw PngError("Problem creating png read structure");
+ BOOST_THROW_EXCEPTION(PngError("Problem creating png read structure"));
}
// Allocate/initialize the memory for image information.
@@ -296,14 +297,14 @@ BOOL LLPngWrapper::writePng(const LLImageRaw* rawImage, U8* dest)
if (mColorType == -1)
{
- throw PngError("Unsupported image: unexpected number of channels");
+ BOOST_THROW_EXCEPTION(PngError("Unsupported image: unexpected number of channels"));
}
mWritePngPtr = png_create_write_struct(PNG_LIBPNG_VER_STRING,
NULL, &errorHandler, NULL);
if (!mWritePngPtr)
{
- throw PngError("Problem creating png write structure");
+ BOOST_THROW_EXCEPTION(PngError("Problem creating png write structure"));
}
mWriteInfoPtr = png_create_info_struct(mWritePngPtr);