diff options
author | Jon Skeet <jonskeet@google.com> | 2016-01-15 10:43:06 +0000 |
---|---|---|
committer | Jon Skeet <jonskeet@google.com> | 2016-01-15 10:43:06 +0000 |
commit | 1a34ac03bed31434caa110acc25537d871966f9d (patch) | |
tree | 86da369b3748d9efff3afd90f6090b42ff93f8c0 /csharp/src/Google.Protobuf/InvalidProtocolBufferException.cs | |
parent | 730c38ad8c11429bc7ea0310bc1b82f0831b42a6 (diff) | |
download | protobuf-1a34ac03bed31434caa110acc25537d871966f9d.tar.gz protobuf-1a34ac03bed31434caa110acc25537d871966f9d.tar.bz2 protobuf-1a34ac03bed31434caa110acc25537d871966f9d.zip |
Throw a better exception when invalid base64 is detected in JSON
Diffstat (limited to 'csharp/src/Google.Protobuf/InvalidProtocolBufferException.cs')
-rw-r--r-- | csharp/src/Google.Protobuf/InvalidProtocolBufferException.cs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/csharp/src/Google.Protobuf/InvalidProtocolBufferException.cs b/csharp/src/Google.Protobuf/InvalidProtocolBufferException.cs index cacda648..eeb0f13a 100644 --- a/csharp/src/Google.Protobuf/InvalidProtocolBufferException.cs +++ b/csharp/src/Google.Protobuf/InvalidProtocolBufferException.cs @@ -30,6 +30,7 @@ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#endregion
+using System;
using System.IO;
namespace Google.Protobuf
@@ -45,6 +46,11 @@ namespace Google.Protobuf {
}
+ internal InvalidProtocolBufferException(string message, Exception innerException)
+ : base(message, innerException)
+ {
+ }
+
internal static InvalidProtocolBufferException MoreDataAvailable()
{
return new InvalidProtocolBufferException(
@@ -82,6 +88,11 @@ namespace Google.Protobuf "Protocol message contained an invalid tag (zero).");
}
+ internal static InvalidProtocolBufferException InvalidBase64(Exception innerException)
+ {
+ return new InvalidProtocolBufferException("Invalid base64 data", innerException);
+ }
+
internal static InvalidProtocolBufferException InvalidEndTag()
{
return new InvalidProtocolBufferException(
|