Fix emulator build error
[platform/framework/web/chromium-efl.git] / dbus / dbus_result.cc
1 // Copyright 2023 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "dbus/dbus_result.h"
6 #include "dbus/message.h"
7
8 namespace dbus {
9
10 DBusResult GetResult(dbus::ErrorResponse* response) {
11   if (!response) {
12     return DBusResult::kErrorResponseMissing;
13   }
14
15   const std::string& error_name = response->GetErrorName();
16   if (error_name == DBUS_ERROR_NO_REPLY) {
17     return DBusResult::kErrorNoReply;
18   }
19
20   if (error_name == DBUS_ERROR_TIMEOUT) {
21     return DBusResult::kErrorTimeout;
22   }
23
24   if (error_name == DBUS_ERROR_TIMED_OUT) {
25     return DBusResult::kErrorTimedOut;
26   }
27
28   if (error_name == DBUS_ERROR_NOT_SUPPORTED) {
29     return DBusResult::kErrorNotSupported;
30   }
31
32   if (error_name == DBUS_ERROR_ACCESS_DENIED) {
33     return DBusResult::kErrorAccessDenied;
34   }
35
36   if (error_name == DBUS_ERROR_DISCONNECTED) {
37     return DBusResult::kErrorDisconnected;
38   }
39
40   if (error_name == DBUS_ERROR_FAILED) {
41     return DBusResult::kErrorFailed;
42   }
43
44   if (error_name == DBUS_ERROR_NO_MEMORY) {
45     return DBusResult::kErrorNoMemory;
46   }
47
48   if (error_name == DBUS_ERROR_SERVICE_UNKNOWN) {
49     return DBusResult::kErrorServiceUnknown;
50   }
51
52   if (error_name == DBUS_ERROR_NAME_HAS_NO_OWNER) {
53     return DBusResult::kErrorNameHasNoOwner;
54   }
55
56   if (error_name == DBUS_ERROR_IO_ERROR) {
57     return DBusResult::kErrorIOError;
58   }
59
60   if (error_name == DBUS_ERROR_BAD_ADDRESS) {
61     return DBusResult::kErrorBadAddress;
62   }
63
64   if (error_name == DBUS_ERROR_LIMITS_EXCEEDED) {
65     return DBusResult::kErrorLimitsExceeded;
66   }
67
68   if (error_name == DBUS_ERROR_AUTH_FAILED) {
69     return DBusResult::kErrorAuthFailed;
70   }
71
72   if (error_name == DBUS_ERROR_NO_SERVER) {
73     return DBusResult::kErrorNoServer;
74   }
75
76   if (error_name == DBUS_ERROR_NO_NETWORK) {
77     return DBusResult::kErrorNoNetwork;
78   }
79
80   if (error_name == DBUS_ERROR_ADDRESS_IN_USE) {
81     return DBusResult::kErrorAddressInUse;
82   }
83
84   if (error_name == DBUS_ERROR_DISCONNECTED) {
85     return DBusResult::kErrorDisconnected;
86   }
87
88   if (error_name == DBUS_ERROR_INVALID_ARGS) {
89     return DBusResult::kErrorInvalidArgs;
90   }
91
92   if (error_name == DBUS_ERROR_FILE_NOT_FOUND) {
93     return DBusResult::kErrorFileNotFound;
94   }
95
96   if (error_name == DBUS_ERROR_FILE_EXISTS) {
97     return DBusResult::kErrorFileExists;
98   }
99
100   if (error_name == DBUS_ERROR_UNKNOWN_METHOD) {
101     return DBusResult::kErrorUnknownMethod;
102   }
103
104   if (error_name == DBUS_ERROR_UNKNOWN_OBJECT) {
105     return DBusResult::kErrorUnknownObject;
106   }
107
108   if (error_name == DBUS_ERROR_UNKNOWN_INTERFACE) {
109     return DBusResult::kErrorUnknownInterface;
110   }
111
112   if (error_name == DBUS_ERROR_UNKNOWN_PROPERTY) {
113     return DBusResult::kErrorUnknownProperty;
114   }
115
116   if (error_name == DBUS_ERROR_PROPERTY_READ_ONLY) {
117     return DBusResult::kErrorPropertyReadOnly;
118   }
119
120   if (error_name == DBUS_ERROR_MATCH_RULE_NOT_FOUND) {
121     return DBusResult::kErrorMatchRuleNotFound;
122   }
123
124   if (error_name == DBUS_ERROR_MATCH_RULE_INVALID) {
125     return DBusResult::kErrorMatchRuleInvalid;
126   }
127
128   if (error_name == DBUS_ERROR_SPAWN_EXEC_FAILED) {
129     return DBusResult::kErrorSpawnExecFailed;
130   }
131
132   if (error_name == DBUS_ERROR_SPAWN_FORK_FAILED) {
133     return DBusResult::kErrorSpawnForkFailed;
134   }
135
136   if (error_name == DBUS_ERROR_SPAWN_CHILD_EXITED) {
137     return DBusResult::kErrorSpawnChildExited;
138   }
139
140   if (error_name == DBUS_ERROR_SPAWN_CHILD_SIGNALED) {
141     return DBusResult::kErrorSpawnChildSignaled;
142   }
143
144   if (error_name == DBUS_ERROR_SPAWN_FAILED) {
145     return DBusResult::kErrorSpawnFailed;
146   }
147
148   if (error_name == DBUS_ERROR_SPAWN_SETUP_FAILED) {
149     return DBusResult::kErrorSpawnSetupFailed;
150   }
151
152   if (error_name == DBUS_ERROR_SPAWN_CONFIG_INVALID) {
153     return DBusResult::kErrorSpawnConfigInvalid;
154   }
155
156   if (error_name == DBUS_ERROR_SPAWN_SERVICE_INVALID) {
157     return DBusResult::kErrorSpawnServiceInvalid;
158   }
159
160   if (error_name == DBUS_ERROR_SPAWN_SERVICE_NOT_FOUND) {
161     return DBusResult::kErrorSpawnServiceNotFound;
162   }
163
164   if (error_name == DBUS_ERROR_SPAWN_PERMISSIONS_INVALID) {
165     return DBusResult::kErrorSpawnPermissionsInvalid;
166   }
167
168   if (error_name == DBUS_ERROR_SPAWN_FILE_INVALID) {
169     return DBusResult::kErrorSpawnFileInvalid;
170   }
171
172   if (error_name == DBUS_ERROR_SPAWN_NO_MEMORY) {
173     return DBusResult::kErrorSpawnNoMemory;
174   }
175
176   if (error_name == DBUS_ERROR_UNIX_PROCESS_ID_UNKNOWN) {
177     return DBusResult::kErrorUnixProcessIDUnknown;
178   }
179
180   if (error_name == DBUS_ERROR_INVALID_SIGNATURE) {
181     return DBusResult::kErrorInvalidSignature;
182   }
183
184   if (error_name == DBUS_ERROR_INVALID_FILE_CONTENT) {
185     return DBusResult::kErrorInvalidFileContent;
186   }
187
188   if (error_name == DBUS_ERROR_SELINUX_SECURITY_CONTEXT_UNKNOWN) {
189     return DBusResult::kErrorSELinuxSecurityContextUnknown;
190   }
191
192   if (error_name == DBUS_ERROR_ADT_AUDIT_DATA_UNKNOWN) {
193     return DBusResult::kErrorAdtAuditDataUnknown;
194   }
195
196   if (error_name == DBUS_ERROR_OBJECT_PATH_IN_USE) {
197     return DBusResult::kErrorObjectPathInUse;
198   }
199
200   if (error_name == DBUS_ERROR_INCONSISTENT_MESSAGE) {
201     return DBusResult::kErrorInconsistentMessage;
202   }
203
204   if (error_name == DBUS_ERROR_INTERACTIVE_AUTHORIZATION_REQUIRED) {
205     return DBusResult::kErrorInteractiveAuthorizationRequired;
206   }
207
208   return DBusResult::kErrorUnknown;
209 }
210
211 }  // namespace dbus