summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/errors.cc
diff options
context:
space:
mode:
authorAdam Borowski <kilobyte@angband.pl>2010-08-20 13:06:54 +0200
committerAdam Borowski <kilobyte@angband.pl>2010-09-02 14:17:13 +0200
commit5ad504f48385dcf95439a624c598862391a064af (patch)
tree8660d8942e45d04a74a92b51de7874a921e7b510 /crawl-ref/source/errors.cc
parentb1fd974d564ca862e6571f49bf3790fa219abf18 (diff)
downloadcrawl-ref-5ad504f48385dcf95439a624c598862391a064af.tar.gz
crawl-ref-5ad504f48385dcf95439a624c598862391a064af.zip
Make external fails catchable.
Diffstat (limited to 'crawl-ref/source/errors.cc')
-rw-r--r--crawl-ref/source/errors.cc9
1 files changed, 5 insertions, 4 deletions
diff --git a/crawl-ref/source/errors.cc b/crawl-ref/source/errors.cc
index b61a9eaf79..9fd3362872 100644
--- a/crawl-ref/source/errors.cc
+++ b/crawl-ref/source/errors.cc
@@ -9,6 +9,7 @@
#include <string.h>
#include "AppHdr.h"
+#include "errors.h"
#include "libutil.h"
#include "stuff.h"
@@ -19,8 +20,9 @@ void fail(const char *msg, ...)
std::string buf = vmake_stringf(msg, args);
va_end(args);
- // TODO: throw an exception or sumthing here when expected
- end(1, true, buf.c_str());
+ // Do we want to call end() right on when there's no one trying catching,
+ // or should we risk exception code mess things up?
+ throw ext_fail_exception(buf);
}
void sysfail(const char *msg, ...)
@@ -33,6 +35,5 @@ void sysfail(const char *msg, ...)
buf += ": ";
buf += strerror(errno);
- // TODO: throw an exception or sumthing here when expected
- end(1, true, buf.c_str());
+ throw ext_fail_exception(buf);
}