diff options
author | John Wiegley <johnw@newartisans.com> | 2008-04-13 03:35:00 -0400 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2008-04-13 03:35:00 -0400 |
commit | 42f43b7686038e4cbca16d8d2118b139544e6de3 (patch) | |
tree | 52c5473401c57282242d66b8dd75f4c07bf41d07 /error.h | |
parent | c7b4370ff9c8ab5c96f15b1e712e6db6bdab6324 (diff) | |
download | fork-ledger-42f43b7686038e4cbca16d8d2118b139544e6de3.tar.gz fork-ledger-42f43b7686038e4cbca16d8d2118b139544e6de3.tar.bz2 fork-ledger-42f43b7686038e4cbca16d8d2118b139544e6de3.zip |
Check in all changes made so far toward 3.0.
Diffstat (limited to 'error.h')
-rw-r--r-- | error.h | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -122,4 +122,20 @@ class fatal_assert : public fatal { virtual ~fatal_assert() throw() {} }; +inline void unexpected(char c, char wanted) +{ + if ((unsigned char) c == 0xff) { + if (wanted) + throw new error(std::string("Missing '") + wanted + "'"); + else + throw new error("Unexpected end of input"); + } else { + if (wanted) + throw new error(std::string("Invalid char '") + c + + "' (wanted '" + wanted + "')"); + else + throw new error(std::string("Invalid char '") + c + "'"); + } +} + #endif // _ERROR_H |