@@ -510,11 +510,11 @@ namespace sharp {
510510 option = GetOptionsForImageType (imageType, descriptor);
511511 image = VImage::new_from_buffer (descriptor->buffer , descriptor->bufferLength , nullptr , option);
512512 }
513- } catch (vips::VError const &err) {
514- throw vips::VError (std::string (" Input buffer has corrupt header: " ) + err.what ());
513+ } catch (std::runtime_error const &err) {
514+ throw std::runtime_error (std::string (" Input buffer has corrupt header: " ) + err.what ());
515515 }
516516 } else {
517- throw vips::VError (" Input buffer contains unsupported image format" );
517+ throw std::runtime_error (" Input buffer contains unsupported image format" );
518518 }
519519 }
520520 } else {
@@ -585,10 +585,10 @@ namespace sharp {
585585 imageType = DetermineImageType (descriptor->file .data ());
586586 if (imageType == ImageType::MISSING) {
587587 if (descriptor->file .find (" <svg" ) != std::string::npos) {
588- throw vips::VError (" Input file is missing, did you mean "
588+ throw std::runtime_error (" Input file is missing, did you mean "
589589 " sharp(Buffer.from('" + descriptor->file .substr (0 , 8 ) + " ...')?" );
590590 }
591- throw vips::VError (" Input file is missing: " + descriptor->file );
591+ throw std::runtime_error (" Input file is missing: " + descriptor->file );
592592 }
593593 if (imageType != ImageType::UNKNOWN) {
594594 try {
@@ -600,19 +600,19 @@ namespace sharp {
600600 option = GetOptionsForImageType (imageType, descriptor);
601601 image = VImage::new_from_file (descriptor->file .data (), option);
602602 }
603- } catch (vips::VError const &err) {
604- throw vips::VError (std::string (" Input file has corrupt header: " ) + err.what ());
603+ } catch (std::runtime_error const &err) {
604+ throw std::runtime_error (std::string (" Input file has corrupt header: " ) + err.what ());
605605 }
606606 } else {
607- throw vips::VError (" Input file contains unsupported image format" );
607+ throw std::runtime_error (" Input file contains unsupported image format" );
608608 }
609609 }
610610 }
611611
612612 // Limit input images to a given number of pixels, where pixels = width * height
613613 if (descriptor->limitInputPixels > 0 &&
614614 static_cast <uint64_t >(image.width ()) * image.height () > descriptor->limitInputPixels ) {
615- throw vips::VError (" Input image exceeds pixel limit" );
615+ throw std::runtime_error (" Input image exceeds pixel limit" );
616616 }
617617 return std::make_tuple (image, imageType);
618618 }
@@ -788,19 +788,19 @@ namespace sharp {
788788 : image.height ();
789789 if (imageType == ImageType::JPEG) {
790790 if (image.width () > 65535 || height > 65535 ) {
791- throw vips::VError (" Processed image is too large for the JPEG format" );
791+ throw std::runtime_error (" Processed image is too large for the JPEG format" );
792792 }
793793 } else if (imageType == ImageType::WEBP) {
794794 if (image.width () > 16383 || height > 16383 ) {
795- throw vips::VError (" Processed image is too large for the WebP format" );
795+ throw std::runtime_error (" Processed image is too large for the WebP format" );
796796 }
797797 } else if (imageType == ImageType::GIF) {
798798 if (image.width () > 65535 || height > 65535 ) {
799- throw vips::VError (" Processed image is too large for the GIF format" );
799+ throw std::runtime_error (" Processed image is too large for the GIF format" );
800800 }
801801 } else if (imageType == ImageType::HEIF) {
802802 if (image.width () > 16384 || height > 16384 ) {
803- throw vips::VError (" Processed image is too large for the HEIF format" );
803+ throw std::runtime_error (" Processed image is too large for the HEIF format" );
804804 }
805805 }
806806 }
0 commit comments