From 8957ad82b71ee9a402d3bea57eb97554f5e48776 Mon Sep 17 00:00:00 2001 From: Marcel Greter Date: Tue, 18 Nov 2014 23:50:16 +0100 Subject: [PATCH] Hotfix for new API and error not being re-thrown --- sass_context.cpp | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/sass_context.cpp b/sass_context.cpp index 772e16d5bb..028e59b57b 100644 --- a/sass_context.cpp +++ b/sass_context.cpp @@ -394,25 +394,27 @@ extern "C" { static int sass_compile_context (Sass_Context* c_ctx, Context::Data cpp_opt) { - Context* cpp_ctx = 0; + // first prepare the c++ context + Context* cpp_ctx = sass_prepare_context(c_ctx, cpp_opt); - try { + // parse given context and return root block + Block* root = cpp_ctx ? sass_parse_block(c_ctx, cpp_ctx) : 0; + + if (cpp_ctx && root) { - // first prepare the c++ context - cpp_ctx = sass_prepare_context(c_ctx, cpp_opt); + try { - // parse given context and return root block - Block* root = sass_parse_block(c_ctx, cpp_ctx); + // now compile the parsed root block + c_ctx->output_string = cpp_ctx->compile_block(root); - // now compile the parsed root block - c_ctx->output_string = cpp_ctx->compile_block(root); + // generate source map json and store on context + c_ctx->source_map_string = cpp_ctx->generate_source_map(); - // generate source map json and store on context - c_ctx->source_map_string = cpp_ctx->generate_source_map(); + } + // pass errors to generic error handler + catch (...) { handle_errors(c_ctx); } } - // pass errors to generic error handler - catch (...) { handle_errors(c_ctx); } delete cpp_ctx;