Commit f5dc2c38 by Aaron Leung

Catching allocation exceptions.

parent 92450f84
......@@ -51,7 +51,7 @@ namespace Sass {
importee.parse_scss();
return importee.root;
}
catch (string path) {
catch (string& path) {
read_error("error reading file \"" + path + "\"");
}
}
......
......@@ -54,10 +54,13 @@ extern "C" {
Document doc(0, c_ctx->input_string, cpp_ctx);
c_ctx->output_string = process_document(doc, c_ctx->options.output_style);
}
catch (Error e) {
catch (Error& e) {
cerr << "ERROR -- " << e.file_name << ", line " << e.line_number << ": " << e.message << endl;
c_ctx->output_string = 0;
}
catch(bad_alloc& ba) {
cerr << "ERROR -- unable to allocate memory: " << ba.what() << endl;
}
// TO DO: CATCH EVERYTHING ELSE
return 0;
}
......@@ -70,10 +73,13 @@ extern "C" {
Document doc(c_ctx->input_path, 0, cpp_ctx);
c_ctx->output_string = process_document(doc, c_ctx->options.output_style);
}
catch (Error e) {
catch (Error& e) {
cerr << "ERROR -- " << e.file_name << ", line " << e.line_number << ": " << e.message << endl;
c_ctx->output_string = 0;
}
catch(bad_alloc& ba) {
cerr << "ERROR -- unable to allocate memory: " << ba.what() << endl;
}
// TO DO: CATCH EVERYTHING ELSE
return 0;
}
......
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