blob: 654846767b533ee49108a71bfae014d1ff890a02 [file] [log] [blame]
Chris Masone8fe2c7e2011-06-09 15:51:19 -07001// Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef SHILL_ERROR_
6#define SHILL_ERROR_
7
8#include <string>
9
10#include <base/basictypes.h>
11
12namespace DBus {
13class Error;
14} // namespace DBus
15
16namespace shill {
17
18class Error {
19 public:
20 enum Type {
21 kAlreadyExists,
22 kInProgress,
23 kInternalError,
24 kInvalidArguments,
25 kInvalidNetworkName,
26 kInvalidPassphrase,
27 kInvalidProperty,
28 kNotFound,
29 kNotSupported,
30 kPermissionDenied,
31 kPinError,
32 kNumErrors
33 };
34
35 Error(Type type, const std::string& message);
36 virtual ~Error();
37
38 void Populate(Type type, const std::string& message);
39
40 void ToDBusError(::DBus::Error *error);
41
42 private:
43 static const char * const kErrorNames[kNumErrors];
44
45 Type type_;
46 std::string message_;
47
48 DISALLOW_COPY_AND_ASSIGN(Error);
49};
50
51} // namespace shill
52
53#endif // SHILL_ERROR_