libdap Updated for version 3.20.10
libdap4 is an implementation of OPeNDAP's DAP protocol.
InternalErr.cc
1
2// -*- mode: c++; c-basic-offset:4 -*-
3
4// This file is part of libdap, A C++ implementation of the OPeNDAP Data
5// Access Protocol.
6
7// Copyright (c) 2002,2003 OPeNDAP, Inc.
8// Author: James Gallagher <jgallagher@opendap.org>
9//
10// This library is free software; you can redistribute it and/or
11// modify it under the terms of the GNU Lesser General Public
12// License as published by the Free Software Foundation; either
13// version 2.1 of the License, or (at your option) any later version.
14//
15// This library is distributed in the hope that it will be useful,
16// but WITHOUT ANY WARRANTY; without even the implied warranty of
17// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18// Lesser General Public License for more details.
19//
20// You should have received a copy of the GNU Lesser General Public
21// License along with this library; if not, write to the Free Software
22// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23//
24// You can contact OPeNDAP, Inc. at PO Box 112, Saunderstown, RI. 02874-0112.
25
26// (c) COPYRIGHT URI/MIT 1999
27// Please read the full copyright statement in the file COPYRIGHT_URI.
28//
29// Authors:
30// jhrg,jimg James Gallagher <jgallagher@gso.uri.edu>
31
32// Implementation for the InternalErr class.
33
34
35#include "config.h"
36
37#include <string>
38#include <sstream>
39
40#include "InternalErr.h"
41#include "util.h"
42
43using std::endl;
44using std::ostringstream;
45
46namespace libdap {
47
48InternalErr::InternalErr() : Error()
49{
50 _error_code = internal_error;
51}
52
53InternalErr::InternalErr(const string &msg) : Error()
54{
55 _error_code = internal_error;
56 _error_message = "";
57 _error_message += "An internal error was encountered:\n";
58 _error_message += msg + "\n";
59 _error_message += "Please report this to support@opendap.org\n";
60}
61
62
63//InternalErr::InternalErr(string msg, string file, int line)
64// : Error(unknown_error, msg)
65InternalErr::InternalErr(const string &file, const int &line, const string &msg) : Error(msg, file, line)
66{
67 _error_code = internal_error;
68 _error_message = "";
69 _error_message += "An internal error was encountered in " + file + " at line ";
70 // Jose Garcia. Next we append line to the string _error_code.
71 // This function is defined in util.h
72 append_long_to_string(line, 10, _error_message);
73 _error_message += ":\n";
74 _error_message += msg + "\n";
75 _error_message += "Please report this to support@opendap.org\n";
76}
77
78InternalErr::InternalErr(const InternalErr &copy_from) noexcept
79 : Error(copy_from)
80{}
81
82InternalErr::~InternalErr() noexcept
83{}
84
85InternalErr &
86InternalErr::operator=(const InternalErr &rhs) {
87 if (this == &rhs) return *this;
88
89 _error_code = rhs._error_code;
90 _error_message = rhs._error_message;
91
92 d_file = rhs.d_file;
93 d_line = rhs.d_line;
94
95 return *this;
96}
97
101bool
102InternalErr::OK()
103{
104 return Error::OK();
105}
106
107} // namespace libdap
top level DAP object to house generic methods