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