/* * Exception.cpp * * Copyright (C) 2008 Matthias Schiffer * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published by the * Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along * with this program. If not, see . */ #include "Exception.h" #include namespace Mad { namespace Core { void Exception::updateWhatStr() { if(where.empty()) whatStr.clear(); else whatStr = where + ": "; switch(errorCode) { case SUCCESS: whatStr += "Success"; break; case UNEXPECTED_PACKET: whatStr += "An unexpected packet was received"; break; case INVALID_ACTION: whatStr += "The action is invalid"; break; case NOT_AVAILABLE: whatStr += "Not available"; break; case NOT_FINISHED: whatStr += "Not finished"; break; case NOT_IMPLEMENTED: whatStr += "Not implemented"; break; case NOT_FOUND: whatStr += "Not found"; break; case INVALID_INPUT: whatStr += "Invalid input"; break; case PERMISSION: whatStr += "Permission denied"; break; case INTERNAL_ERRNO: whatStr += std::strerror(subCode); break; case INVALID_ADDRESS: whatStr += "Invalid address"; break; case ALREADY_IDENTIFIED: whatStr += "The host is already identified"; break; case UNKNOWN_DAEMON: whatStr += "The daemon is unknown"; break; case DUPLICATE_ENTRY: whatStr += "Duplicate entry"; break; case AUTHENTICATION: whatStr += "Authentication failure"; break; default: whatStr += "Unknown error"; } } } }