cuelang.org/go@v0.10.1/encoding/protobuf/testdata/google/rpc/status.proto (about) 1 // Copyright 2017 Google Inc. 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 syntax = "proto3"; 16 17 package google.rpc; 18 19 import "google/protobuf/any.proto"; 20 21 option go_package = "google.golang.org/genproto/googleapis/rpc/status;status"; 22 option java_multiple_files = true; 23 option java_outer_classname = "StatusProto"; 24 option java_package = "com.google.rpc"; 25 option objc_class_prefix = "RPC"; 26 27 // The `Status` type defines a logical error model that is suitable for 28 // different programming environments, including REST APIs and RPC APIs. It is 29 // used by [gRPC](https://github.com/grpc). The error model is designed to be: 30 // 31 // - Simple to use and understand for most users 32 // - Flexible enough to meet unexpected needs 33 // 34 // # Overview 35 // 36 // The `Status` message contains three pieces of data: error code, error 37 // message, and error details. The error code should be an enum value of 38 // [google.rpc.Code][google.rpc.Code], but it may accept additional error codes 39 // if needed. The error message should be a developer-facing English message 40 // that helps developers *understand* and *resolve* the error. If a localized 41 // user-facing error message is needed, put the localized message in the error 42 // details or localize it in the client. The optional error details may contain 43 // arbitrary information about the error. There is a predefined set of error 44 // detail types in the package `google.rpc` that can be used for common error 45 // conditions. 46 // 47 // # Language mapping 48 // 49 // The `Status` message is the logical representation of the error model, but it 50 // is not necessarily the actual wire format. When the `Status` message is 51 // exposed in different client libraries and different wire protocols, it can be 52 // mapped differently. For example, it will likely be mapped to some exceptions 53 // in Java, but more likely mapped to some error codes in C. 54 // 55 // # Other uses 56 // 57 // The error model and the `Status` message can be used in a variety of 58 // environments, either with or without APIs, to provide a 59 // consistent developer experience across different environments. 60 // 61 // Example uses of this error model include: 62 // 63 // - Partial errors. If a service needs to return partial errors to the client, 64 // it may embed the `Status` in the normal response to indicate the partial 65 // errors. 66 // 67 // - Workflow errors. A typical workflow has multiple steps. Each step may 68 // have a `Status` message for error reporting. 69 // 70 // - Batch operations. If a client uses batch request and batch response, the 71 // `Status` message should be used directly inside batch response, one for 72 // each error sub-response. 73 // 74 // - Asynchronous operations. If an API call embeds asynchronous operation 75 // results in its response, the status of those operations should be 76 // represented directly using the `Status` message. 77 // 78 // - Logging. If some API errors are stored in logs, the message `Status` could 79 // be used directly after any stripping needed for security/privacy reasons. 80 message Status { 81 // The status code, which should be an enum value of 82 // [google.rpc.Code][google.rpc.Code]. 83 int32 code = 1; 84 85 // A developer-facing error message, which should be in English. Any 86 // user-facing error message should be localized and sent in the 87 // [google.rpc.Status.details][google.rpc.Status.details] field, or localized 88 // by the client. 89 string message = 2; 90 91 // A list of messages that carry the error details. There is a common set of 92 // message types for APIs to use. 93 repeated google.protobuf.Any details = 3; 94 }