/usr/include/libdap/Error.h is in libdap-dev 3.12.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 | // -*- mode: c++; c-basic-offset:4 -*-
// This file is part of libdap, A C++ implementation of the OPeNDAP Data
// Access Protocol.
// Copyright (c) 2002,2003 OPeNDAP, Inc.
// Author: James Gallagher <jgallagher@opendap.org>
//
// This library 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 2.1 of the License, or (at your option) any later version.
//
// This library 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 library; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
//
// You can contact OPeNDAP, Inc. at PO Box 112, Saunderstown, RI. 02874-0112.
// (c) COPYRIGHT URI/MIT 1999,2000
// Please read the full copyright statement in the file COPYRIGHT_URI.
//
// Authors:
// jhrg,jimg James Gallagher <jgallagher@gso.uri.edu>
// Interface for the Error class
//
// jhrg 4/23/96
#ifndef _error_h
#define _error_h
#include <cstdio> // For FILE *
#include <iostream>
#include <string>
using std::cout;
using std::string;
using std::ostream;
namespace libdap
{
/** The most common errors within DAP2 have special codes so that they
can be spotted easily by the client software. Any error
without a matching code gets the <tt>unknown_error</tt> code.
@brief An enumerated type for common errors. */
typedef int ErrorCode; //using standard errno+netCDF error codes from server
/** @name Internal DAP errors */
//@{
#define undefined_error 1000 ///< Undefined error code
#define unknown_error 1001 ///< Unknown error
#define internal_error 1002 ///< Internal server error
#define no_such_file 1003
#define no_such_variable 1004
#define malformed_expr 1005
#define no_authorization 1006
#define cannot_read_file 1007
#define dummy_message 1008 // Dumplicate of 1007; see Error.cc
//@}
/** The Error class is used to transport error information from the server to
the client within libdap. This class is also the base class for all the
errors thrown by methods in the DAP, so catching Error will catch all DAP
throws. Errors consist of an error code and a string. The code can be
used to quickly distinguish between certain common errors while the
string is used to convey information about the error to the user. The
error code should never be displayed to the user.
This class is used on both clients and servers. The \e print() and \e
parse() methods are used to send the object back and forth.
@note A past version of this class supported the notion of an error
correcting program (Tcl, Java, ...) that could be sent from the server to
the client to help users correct the error and resubmit the request. This
never worked well in practice and that feature of the class is deprecated.
@brief A class for error processing.
@author jhrg */
class Error
{
protected:
ErrorCode _error_code;
string _error_message;
public:
Error(ErrorCode ec, string msg);
Error(string msg);
Error();
Error(const Error ©_from);
virtual ~Error();
Error &operator=(const Error &rhs);
bool OK() const;
bool parse(FILE *fp);
void print(FILE *out) const;
void print(ostream &out) const;
ErrorCode get_error_code() const;
string get_error_message() const;
void set_error_code(ErrorCode ec = undefined_error);
void set_error_message(string msg = "");
};
} // namespace libdap
#endif // _error_h
|