|
1 | 1 | # Result code and message for service calls.
|
2 |
| -# Note that additional results for specific services can defined within them using values above 100. |
| 2 | +# Note that additional codes for specific services can defined within the service definition. |
| 3 | +# For example, you could define a service CalculateSquareRoot.srv as |
| 4 | +# float64 value |
| 5 | +# --- |
| 6 | +# int32 CODE_NEGATIVE_VALUE = -110 |
| 7 | +# std_msgs/Result result |
| 8 | +# float64 root |
| 9 | +# |
| 10 | +# If a negative value is provided, the server could return the generic CODE_INVALID_ARGUMENT |
| 11 | +# as result.code, or it could provide more context with CODE_NEGATIVE_VALUE. |
| 12 | +# |
| 13 | +# As a general guideline, |
| 14 | +# Positive values are successes |
| 15 | +# Negative values are failures |
| 16 | +# Values between -1 and -100 are for some generic high-level failures |
| 17 | +# Values between -101 and -1000 are for client (caller) errors (a la HTTP 4XX errors) |
| 18 | +# Values between -1001 and -2000 are for server errors (a la HTTP 5XX errors) |
3 | 19 |
|
4 |
| -uint8 RESULT_FEATURE_UNSUPPORTED = 0 # Feature is not supported by the simulator, check GetSimulatorFeatures. |
5 |
| - # While feature support can sometimes be deduced from presence of corresponding |
6 |
| - # service / action interface, in other cases it is about supporting certain |
7 |
| - # call parameters, formats and options within interface call. |
8 |
| -uint8 RESULT_OK = 1 |
9 |
| -uint8 RESULT_NOT_FOUND = 2 # No match for input (such as when entity name does not exist). |
10 |
| -uint8 RESULT_INCORRECT_STATE = 3 # Simulator is in an incorrect state for this interface call, e.g. a service |
11 |
| - # requires paused state but the simulator is not paused. |
12 |
| -uint8 RESULT_OPERATION_FAILED = 4 # Request could not be completed successfully even though feature is supported |
13 |
| - # and the input is correct; check error_message for details. |
14 |
| - # Implementation rule: check extended codes for called service |
15 |
| - # (e.g. SpawnEntity) to provide a return code which is more specific. |
| 20 | +int32 CODE_UNKNOWN = 0 |
| 21 | +int32 CODE_OK = 1 |
16 | 22 |
|
17 |
| -int32 result # Result to be checked on return from service interface call |
| 23 | +int32 CODE_GENERAL_FAILURE = -1 |
| 24 | + |
| 25 | +# Client Errors |
| 26 | +int32 CODE_CANCELLED = -101 |
| 27 | +int32 CODE_INVALID_ARGUMENT = -102 |
| 28 | +int32 CODE_NOT_FOUND = -103 |
| 29 | +int32 CODE_ALREADY_EXISTS = -104 |
| 30 | +int32 CODE_PERMISSION_DENIED = -105 |
| 31 | +int32 CODE_FAILED_PRECONDITION = -106 |
| 32 | +int32 CODE_OUT_OF_RANGE = -107 |
| 33 | + |
| 34 | +# Server Errors |
| 35 | +int32 CODE_INTERNAL = -1000 |
| 36 | +int32 CODE_UNIMPLEMENTED = -1001 |
| 37 | +int32 CODE_UNAVAILABLE = -1002 |
| 38 | +int32 CODE_DEADLINE_EXCEEDED = -1003 |
| 39 | + |
| 40 | +int32 code # Code number to be checked on return from service interface call |
18 | 41 | string error_message # Additional error description when useful.
|
0 commit comments