Commit 998c7b2f authored by Davis King's avatar Davis King

Fixed code so it throws the right type of exception.

parent ddac90f4
......@@ -4,7 +4,7 @@
#define DLIB_SAVE_PnG_H__
#include "save_png_abstract.h"
#include "../image_loader/image_loader.h"
#include "image_saver.h"
#include "dlib/array2d.h"
#include "dlib/pixel.h"
#include <cstdio>
......@@ -62,7 +62,7 @@ namespace dlib
/* Open the file */
fp = fopen(file_name.c_str(), "wb");
if (fp == NULL)
throw image_load_error("Unable to open " + file_name + " for writing.");
throw image_save_error("Unable to open " + file_name + " for writing.");
/* Create and initialize the png_struct with the desired error handler
* functions. If you want to use the default stderr and longjump method,
......@@ -75,7 +75,7 @@ namespace dlib
if (png_ptr == NULL)
{
fclose(fp);
throw image_load_error("Error while writing PNG file " + file_name);
throw image_save_error("Error while writing PNG file " + file_name);
}
/* Allocate/initialize the image information data. REQUIRED */
......@@ -84,7 +84,7 @@ namespace dlib
{
fclose(fp);
png_destroy_write_struct(&png_ptr, NULL);
throw image_load_error("Error while writing PNG file " + file_name);
throw image_save_error("Error while writing PNG file " + file_name);
}
/* Set error handling. REQUIRED if you aren't supplying your own
......@@ -95,7 +95,7 @@ namespace dlib
/* If we get here, we had a problem writing the file */
fclose(fp);
png_destroy_write_struct(&png_ptr, &info_ptr);
throw image_load_error("Error while writing PNG file " + file_name);
throw image_save_error("Error while writing PNG file " + file_name);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment