/* * 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.isEmpty()) errorStr.remove(); else errorStr = where + ": "; switch(errorCode) { case SUCCESS: errorStr += "Success"; break; case UNEXPECTED_PACKET: errorStr += "An unexpected packet was received"; break; case INVALID_ACTION: errorStr += "The action is invalid"; break; case NOT_AVAILABLE: errorStr += "Not available"; break; case NOT_FINISHED: errorStr += "Not finished"; break; case NOT_IMPLEMENTED: errorStr += "Not implemented"; break; case NOT_FOUND: errorStr += "Not found"; break; case INVALID_INPUT: errorStr += "Invalid input"; break; case PERMISSION: errorStr += "Permission denied"; break; case INTERNAL_ERRNO: errorStr += std::strerror(subCode); break; case INVALID_ADDRESS: errorStr += "Invalid address"; break; case ALREADY_IDENTIFIED: errorStr += "The host is already identified"; break; case UNKNOWN_DAEMON: whatStr += "The daemon is unknown"; break; case DUPLICATE_ENTRY: errorStr += "Duplicate entry"; break; case AUTHENTICATION: errorStr += "Authentication failure"; break; default: errorStr += "Unknown error"; } whatStr = errorStr.toLocale(); } } }