1// Copyright 2016 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 15syntax = "proto3"; 16 17package google.rpc; 18 19import "google/protobuf/any.proto"; 20 21option go_package = "google.golang.org/genproto/googleapis/rpc/status;status"; 22option java_multiple_files = true; 23option java_outer_classname = "StatusProto"; 24option java_package = "com.google.rpc"; 25option objc_class_prefix = "RPC"; 26 27 28// The `Status` type defines a logical error model that is suitable for different 29// programming environments, including REST APIs and RPC APIs. It is used by 30// [gRPC](https://github.com/grpc). The error model is designed to be: 31// 32// - Simple to use and understand for most users 33// - Flexible enough to meet unexpected needs 34// 35// # Overview 36// 37// The `Status` message contains three pieces of data: error code, error message, 38// and error details. The error code should be an enum value of 39// [google.rpc.Code][google.rpc.Code], but it may accept additional error codes if needed. The 40// error message should be a developer-facing English message that helps 41// developers *understand* and *resolve* the error. If a localized user-facing 42// error message is needed, put the localized message in the error details or 43// localize it in the client. The optional error details may contain arbitrary 44// information about the error. There is a predefined set of error detail types 45// in the package `google.rpc` which can be used for common error 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 purpose. 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. 80message Status { 81 // The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code]. 82 int32 code = 1; 83 84 // A developer-facing error message, which should be in English. Any 85 // user-facing error message should be localized and sent in the 86 // [google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client. 87 string message = 2; 88 89 // A list of messages that carry the error details. There will be a 90 // common set of message types for APIs to use. 91 repeated google.protobuf.Any details = 3; 92} 93