From bd8221d2791718f02ab1d067c797c62b29da9106 Mon Sep 17 00:00:00 2001 From: deva Date: Mon, 4 Aug 2008 09:17:36 +0000 Subject: Added NotFound exception when trying to open a non-existing and non-empty macro. --- server/src/server.cc | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'server') diff --git a/server/src/server.cc b/server/src/server.cc index 27a6b9d..6f875b8 100644 --- a/server/src/server.cc +++ b/server/src/server.cc @@ -63,6 +63,12 @@ static std::string error_box(std::string message) return errorbox; } +class NotFoundException : public Exception { +public: + NotFoundException(Request &r) + : Exception("Macro " + r.macro + " not found in course " + r.course) {} +}; + static void connection(TCPSocket &socket) { socket.write("\n"); @@ -154,6 +160,8 @@ static void connection(TCPSocket &socket) answer += templ->course.attributes["name"]; answer += "\">\n"; + bool foundmacro = false; + // Generate the macro and return it to the client std::vector< Macro >::iterator mi2 = templ->course.macroes.begin(); while(mi2 != templ->course.macroes.end()) { @@ -162,11 +170,12 @@ static void connection(TCPSocket &socket) answer += "