Exemple #1
0
void raise(const exception_t& e)
{
  __exception = general_exception(e.what());

  // Uncaught exception?
  if ( catch_points.empty() ) {
    fprintf(stderr, "Uncaught exception: %s\n", e.what());
    fprintf(stderr, "Sorry for calling abort() here and crash-reporting, but\n"
                    "if you don't like that, you can just change the code to\n"
                    "whatever you want.\n");
    abort();
  }

  jmp_buf *jmp = catch_point();
  pop_catch_point();
  longjmp(*jmp, 1);
}
  CATCH (const exception_t& e) {
    const char* file = global_opts.current_filename;
    bool has_file = file && strcmp(file, "-");

    /*
     * Finish any unfinished printing before
     * writing errors.
     */
    fflush(stdout);

    fprintf(stderr, "\nError%s%s: %s\n",
      has_file? " in " : "",
      has_file? file : "",
      e.what());

    backtrace();
    backtrace_clear();
    exit(1);
  }
Exemple #3
0
 CATCH(const exception_t& e) {
   int i=0; if ( e.what() ) ++i; // suppress unused variable warning
 }