diff --git a/src/runtime/c/pgf/data.h b/src/runtime/c/pgf/data.h index 812213071..54baabf26 100644 --- a/src/runtime/c/pgf/data.h +++ b/src/runtime/c/pgf/data.h @@ -38,16 +38,7 @@ class PGF_INTERNAL_DECL pgf_error : public std::runtime_error { public: pgf_error(const char *msg) : std::runtime_error(msg) { - this->msg = msg; } - - virtual const char *what() const throw () - { - return msg; - } - -private: - const char *msg; }; class PGF_INTERNAL_DECL pgf_systemerror : public std::runtime_error { diff --git a/src/runtime/c/pgf/pgf.cxx b/src/runtime/c/pgf/pgf.cxx index 0696ab702..3f7ade334 100644 --- a/src/runtime/c/pgf/pgf.cxx +++ b/src/runtime/c/pgf/pgf.cxx @@ -2304,7 +2304,14 @@ void pgf_create_lincat(PgfDB *db, ref abscat = namespace_lookup(pgf->abstract.cats, name); if (abscat == 0) { - throw pgf_error("There is no corresponding category in the abstract syntax"); + PgfPrinter printer(NULL, 0, NULL); + printer.puts("Category "); + printer.efun(name); + printer.puts(" is not defined in the abstract syntax"); + PgfText *msg = printer.get_text(); + pgf_error err = pgf_error(msg->text); + free(msg); + throw err; } ref lincat = @@ -2373,7 +2380,14 @@ void pgf_create_lin(PgfDB *db, ref absfun = namespace_lookup(pgf->abstract.funs, name); if (absfun == 0) { - throw pgf_error("There is no corresponding function in the abstract syntax"); + PgfPrinter printer(NULL, 0, NULL); + printer.puts("Function "); + printer.efun(name); + printer.puts(" is not defined in the abstract syntax"); + PgfText *msg = printer.get_text(); + pgf_error err = pgf_error(msg->text); + free(msg); + throw err; } ref lin = @@ -2406,7 +2420,14 @@ void pgf_alter_lin(PgfDB *db, ref absfun = namespace_lookup(pgf->abstract.funs, name); if (absfun == 0) { - throw pgf_error("There is no corresponding function in the abstract syntax"); + PgfPrinter printer(NULL, 0, NULL); + printer.puts("Function "); + printer.efun(name); + printer.puts(" is not defined in the abstract syntax"); + PgfText *msg = printer.get_text(); + pgf_error err = pgf_error(msg->text); + free(msg); + throw err; } ref lin =