aboutsummaryrefslogtreecommitdiffhomepage
path: root/csharp/src/Google.Protobuf/JsonParser.cs
diff options
context:
space:
mode:
authorGravatar Jon Skeet <jonskeet@google.com>2015-11-04 11:49:15 +0000
committerGravatar Jon Skeet <jonskeet@google.com>2015-11-05 10:40:22 +0000
commit0fb39c4afee919eb7c2e5e6c5a254cb2ddcda724 (patch)
tree0b66d171c953994cb2289006fe54241bd81396fa /csharp/src/Google.Protobuf/JsonParser.cs
parentb6a32e909b1f58f157c19276af233e44627093f4 (diff)
Created a new exception for JSON failures.
This is only thrown directly by JsonTokenizer, but surfaces from JsonParser as well. I've added doc comments to hopefully make everything clear. The exception is actually thrown by the reader within JsonTokenizer, in anticipation of keeping track of the location within the document, but that change is not within this PR.
Diffstat (limited to 'csharp/src/Google.Protobuf/JsonParser.cs')
-rw-r--r--csharp/src/Google.Protobuf/JsonParser.cs4
1 files changed, 4 insertions, 0 deletions
diff --git a/csharp/src/Google.Protobuf/JsonParser.cs b/csharp/src/Google.Protobuf/JsonParser.cs
index 6d2638d9..8da57745 100644
--- a/csharp/src/Google.Protobuf/JsonParser.cs
+++ b/csharp/src/Google.Protobuf/JsonParser.cs
@@ -337,6 +337,8 @@ namespace Google.Protobuf
/// </summary>
/// <typeparam name="T">The type of message to create.</typeparam>
/// <param name="json">The JSON to parse.</param>
+ /// <exception cref="InvalidJsonException">The JSON does not comply with RFC 7159</exception>
+ /// <exception cref="InvalidProtocolBufferException">The JSON does not represent a Protocol Buffers message correctly</exception>
public T Parse<T>(string json) where T : IMessage, new()
{
return Parse<T>(new StringReader(json));
@@ -347,6 +349,8 @@ namespace Google.Protobuf
/// </summary>
/// <typeparam name="T">The type of message to create.</typeparam>
/// <param name="jsonReader">Reader providing the JSON to parse.</param>
+ /// <exception cref="InvalidJsonException">The JSON does not comply with RFC 7159</exception>
+ /// <exception cref="InvalidProtocolBufferException">The JSON does not represent a Protocol Buffers message correctly</exception>
public T Parse<T>(TextReader jsonReader) where T : IMessage, new()
{
T message = new T();