From c35260130119e6e4421567f8c99cfe102c6b9a22 Mon Sep 17 00:00:00 2001 From: Tj Holowaychuk Date: Wed, 27 Oct 2010 11:49:43 -0700 Subject: [PATCH] Re-throwing exceptions in streamPNG callback --- src/canvas.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/canvas.cc b/src/canvas.cc index b5f1c0b..bcc0cae 100644 --- a/src/canvas.cc +++ b/src/canvas.cc @@ -81,8 +81,11 @@ Canvas::StreamPNG(const Arguments &args) { Canvas *canvas = ObjectWrap::Unwrap(args.This()); closure_t closure; closure.fn = Handle::Cast(args[0]); + TryCatch try_catch; cairo_status_t status = cairo_surface_write_to_png_stream(canvas->getSurface(), writeToBuffer, &closure); - if (status) { + if (try_catch.HasCaught()) { + return try_catch.ReThrow(); + } else if (status) { Handle argv[1] = { Canvas::Error(status) }; closure.fn->Call(Context::GetCurrent()->Global(), 1, argv); } else {