error.cc

Go to the documentation of this file.
00001 ///
00002 /// \file       error.cc
00003 ///             Common exception classes for the Barry library
00004 ///
00005 
00006 /*
00007     Copyright (C) 2005-2009, Net Direct Inc. (http://www.netdirect.ca/)
00008 
00009     This program is free software; you can redistribute it and/or modify
00010     it under the terms of the GNU General Public License as published by
00011     the Free Software Foundation; either version 2 of the License, or
00012     (at your option) any later version.
00013 
00014     This program is distributed in the hope that it will be useful,
00015     but WITHOUT ANY WARRANTY; without even the implied warranty of
00016     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00017 
00018     See the GNU General Public License in the COPYING file at the
00019     root directory of this project for more details.
00020 */
00021 
00022 #include "error.h"
00023 #include <sstream>
00024 #include <string.h>
00025 
00026 using namespace std;
00027 
00028 namespace Barry {
00029 
00030 std::string BadSize::GetMsg(unsigned int p, unsigned int d, unsigned int r)
00031 {
00032         std::ostringstream oss;
00033         oss << "Bad packet size. Packet: " << p
00034             << ". DataSize(): " << d
00035             << ". Required size: " << r;
00036         return oss.str();
00037 }
00038 
00039 std::string ErrnoError::GetMsg(const std::string &msg, int err)
00040 {
00041         std::ostringstream oss;
00042         oss << msg << ": (errno " << err << ") " << strerror(err);
00043         return oss.str();
00044 }
00045 
00046 } // namespace Barry
00047 

Generated on Mon Jan 12 10:51:12 2009 for Barry by  doxygen 1.5.7.1