Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

CommonErrors.H

Go to the documentation of this file.
00001 // Copyright (C) 2001, Compaq Computer Corporation
00002 // 
00003 // This file is part of Vesta.
00004 // 
00005 // Vesta is free software; you can redistribute it and/or
00006 // modify it under the terms of the GNU Lesser General Public
00007 // License as published by the Free Software Foundation; either
00008 // version 2.1 of the License, or (at your option) any later version.
00009 // 
00010 // Vesta is distributed in the hope that it will be useful,
00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013 // Lesser General Public License for more details.
00014 // 
00015 // You should have received a copy of the GNU Lesser General Public
00016 // License along with Vesta; if not, write to the Free Software
00017 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018 
00019 // Created on Wed Mar 12 20:55:43 PST 1997 by heydon
00020 
00021 // Last modified on Mon Aug  9 17:03:31 EDT 2004 by ken@xorian.net
00022 //      modified on Mon Jun 29 12:24:01 PDT 1998 by heydon
00023 
00024 // CommonErrors.H -- defines common error classes that can occur from
00025 //   input, system, and repository operations
00026 
00027 #ifndef _COMMON_ERRORS_H
00028 #define _COMMON_ERRORS_H
00029 
00030 #include <errno.h>
00031 #include <Basics.H>
00032 #include <VestaSource.H>
00033 
00034 /* An "InputError" exception is thrown to indicate an error in the
00035    weeder instructions input file. */
00036 class InputError {
00037   public:
00038     InputError(const char *error_msg, const char *arg = "") throw ()
00039       : msg(error_msg), arg(arg) { /* SKIP */ }
00040     friend std::ostream& operator<<(std::ostream &os, const InputError &err) throw ();
00041     Text arg; // must be public for manipulation by "ProcessPattern"
00042   private:
00043     const char *msg;
00044 };
00045 
00046 /* A "SysError" exception is thrown to indicate the failure of a
00047    system call. */
00048 class SysError {
00049   public:
00050     SysError(const char *routine) throw ()
00051         : routine(routine) { this->myerrno = errno; }
00052     friend std::ostream& operator<<(std::ostream &os, const SysError &err) throw ();
00053   private:
00054     const char *routine; // for example, "stat(2)"
00055     int myerrno;
00056 };
00057 
00058 /* A "ReposError" exception is thrown to indicate the failure of
00059    an operation on the Vesta repository server. */
00060 class ReposError {
00061   public:
00062     ReposError(VestaSource::errorCode errCode, const char *op,
00063       const char *arg = "") throw ()
00064       : code(errCode), op(op), arg(arg) { /*SKIP*/ }
00065     friend std::ostream& operator<<(std::ostream &os, const ReposError &err) throw ();
00066   private:
00067     VestaSource::errorCode code; // repository error code
00068     const char *op;  // failing operation
00069     const Text arg;  // optional argument
00070 };
00071 
00072 #endif // _COMMON_ERRORS_H

Generated on Mon May 8 00:48:58 2006 for Vesta by  doxygen 1.4.2