blob: cf04a3bc8d03f3454e16b496237e1e0278fed8fb [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 };
Chris Masone3bd3c8c2011-06-13 08:20:26 -070034 static const char * const kErrorNames[kNumErrors];
Chris Masone8fe2c7e2011-06-09 15:51:19 -070035
36 Error(Type type, const std::string& message);
37 virtual ~Error();
38
39 void Populate(Type type, const std::string& message);
40
41 void ToDBusError(::DBus::Error *error);
42
43 private:
Chris Masone8fe2c7e2011-06-09 15:51:19 -070044 Type type_;
45 std::string message_;
46
47 DISALLOW_COPY_AND_ASSIGN(Error);
48};
49
50} // namespace shill
51
52#endif // SHILL_ERROR_