1
// Copyright 2009-2014 Toby Schneider (https://launchpad.net/~tes)
2
// GobySoft, LLC (2013-)
3
// Massachusetts Institute of Technology (2007-2014)
4
// Goby Developers Team (https://launchpad.net/~goby-dev)
7
// This file is part of the Goby Underwater Autonomy Project Libraries
8
// ("The Goby Libraries").
10
// The Goby Libraries are free software: you can redistribute them and/or modify
11
// them under the terms of the GNU Lesser General Public License as published by
12
// the Free Software Foundation, either version 2.1 of the License, or
13
// (at your option) any later version.
15
// The Goby Libraries are distributed in the hope that they will be useful,
16
// but WITHOUT ANY WARRANTY; without even the implied warranty of
17
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
// GNU Lesser General Public License for more details.
20
// You should have received a copy of the GNU Lesser General Public License
21
// along with Goby. If not, see <http://www.gnu.org/licenses/>.
24
#ifndef FrontSeatException20130221H
25
#define FrontSeatException20130221H
27
class FrontSeatException : std::runtime_error
31
: std::runtime_error("Unknown FrontSeatException"),
32
helm_err_(goby::moos::protobuf::ERROR_HELM_NONE),
33
is_helm_error_(false),
34
fs_err_(goby::moos::protobuf::ERROR_FRONTSEAT_NONE),
38
FrontSeatException(goby::moos::protobuf::HelmError err)
39
: std::runtime_error(goby::moos::protobuf::HelmError_Name(err)),
42
fs_err_(goby::moos::protobuf::ERROR_FRONTSEAT_NONE),
45
FrontSeatException(goby::moos::protobuf::FrontSeatError err)
46
: std::runtime_error(goby::moos::protobuf::FrontSeatError_Name(err)),
47
helm_err_(goby::moos::protobuf::ERROR_HELM_NONE),
48
is_helm_error_(false),
54
goby::moos::protobuf::HelmError helm_err() const { return helm_err_; }
55
bool is_helm_error() const { return is_helm_error_; }
57
goby::moos::protobuf::FrontSeatError fs_err() const { return fs_err_; }
58
bool is_fs_error() const { return is_fs_error_; }
61
goby::moos::protobuf::HelmError helm_err_;
64
goby::moos::protobuf::FrontSeatError fs_err_;
68
inline std::ostream& operator<< (std::ostream& os, const FrontSeatException& e)
71
os << "Error in the Helm: " << goby::moos::protobuf::HelmError_Name(e.helm_err());
72
else if(e.is_fs_error())
73
os << "Error in the Frontseat: " << goby::moos::protobuf::FrontSeatError_Name(e.fs_err());
75
os << "Unknown error.";