Subject: | use croak() for errors instead of exit() |
Poppler.xs should not use exit() on error, since that is not catchable.
croak() works better for this.
regards,
bkw
Subject: | Poppler-croak.patch |
--- Poppler.xs.orig 2009-04-28 03:06:33.000000000 +0200
+++ Poppler.xs 2009-10-27 13:12:45.000000000 +0100
@@ -11,9 +11,6 @@
#include <poppler/glib/poppler-page.h>
-#define FAIL(msg) \
- do { fprintf (stderr, "FAIL: %s\n", msg); exit (-1); } while (0)
-
typedef struct {
PopplerDocument *handle;
@@ -58,7 +55,7 @@
document = poppler_document_new_from_file( filename , NULL , NULL );
if( document == NULL ) {
fprintf( stderr , filename );
- FAIL("poppler_document_new_from_file fail"); // XXX: show path usage
+ croak("poppler_document_new_from_file fail"); // XXX: show path usage
}
RETVAL->handle = document;
OUTPUT:
@@ -136,7 +133,7 @@
page = poppler_document_get_page_by_label( THIS->handle , label );
char* class = "Poppler::Page";
if( page == NULL )
- FAIL( "get page failed." );
+ croak( "get page failed." );
RETVAL->handle = page;
OUTPUT:
RETVAL
@@ -156,7 +153,7 @@
page = poppler_document_get_page( THIS->handle , page_num );
char* class = "Poppler::Page"; // XXX: bad hack
if( page == NULL )
- FAIL( "get page failed." );
+ croak( "get page failed." );
RETVAL->handle = page;
OUTPUT: