public sealed class Status : IMessage<Status>, IEquatable<Status>, IDeepCloneable<Status>, IBufferMessage, IMessage
The Status type defines a logical error model that is suitable for
different programming environments, including REST APIs and RPC APIs. It is
used by gRPC. Each Status message contains
three pieces of data: error code, error message, and error details.
You can find out more about this error model and how to work with it in the
API Design Guide.
A developer-facing error message, which should be in English. Any
user-facing error message should be localized and sent in the
[google.rpc.Status.details][google.rpc.Status.details] field, or localized
by the client.
Iterate over the messages in the Details that are messages
in the
standard set of error types defined in the richer error model. Any other messages found in
the Details are ignored and not returned.
foreach (var msg in status.UnpackDetailMessages())
{
switch (msg)
{
case ErrorInfo errorInfo:
// Handle errorInfo ...
break;
// Other cases ...
}
}
Iterate over the messages in the Details that are messages
in the given TypeRegistry. Any other messages found in the Details are ignored
and not returned. This allows iterating over custom messages if you are not using the
standard set of error types defined in the rich error model.
TypeRegistry myTypes = TypeRegistry.FromMessages(FooMessage.Descriptor, BarMessage.Descriptor);
foreach (var msg in status.UnpackDetailMessages(myTypes))
{
switch (msg)
{
case FooMessage foo:
// Handle foo ...
break;
// Other cases ...
}
}
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-12 UTC."],[],[],null,[]]