Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(500)

Side by Side Diff: lib/protobuf/runtime/PbException.dart

Issue 10595002: Protocol Buffer runtime library and 'protoc' plugin (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Work around http://code.google.com/p/dart/issues/detail?id=3806 Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « lib/protobuf/runtime/PbCodec.dart ('k') | lib/protobuf/runtime/PbImmutableList.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file.
4
5 class PbException {
6 String message;
7
8 PbException(this.message) { }
9
10 String toString() => message;
11 }
12
13 class IllegalStateException extends PbException {
14 IllegalStateException(String message)
15 : super("IllegalStateException: $message") { }
16 }
17
18 class UninitializedMessageException extends PbException {
19 UninitializedMessageException(List<String> missingFields) :
20 super("Message missing required fields: "
21 "${Strings.join(missingFields, ', ')}");
22 }
23
24 class PbBufferBusyStateException extends PbException {
25 PbBufferBusyStateException() : super("PbBuffer in busy state.");
26 }
27
28 class InvalidProtocolBufferException extends PbException {
29
30 InvalidProtocolBufferException(String message) :
31 super("InvalidProtocolBufferException: $message") { }
32
33 static InvalidProtocolBufferException invalidEndTag() {
34 return new InvalidProtocolBufferException(
35 "Protocol message end-group tag did not match expected tag.");
36 }
37
38 static InvalidProtocolBufferException invalidTag() {
39 return new InvalidProtocolBufferException(
40 "Protocol message contained an invalid tag (zero).");
41 }
42
43 static InvalidProtocolBufferException invalidWireType() {
44 return new InvalidProtocolBufferException(
45 "Protocol message tag had invalid wire type.");
46 }
47
48 static InvalidProtocolBufferException malformedVarint() {
49 return new InvalidProtocolBufferException(
50 "CodedBufferReader encountered a malformed varint.");
51 }
52
53 static InvalidProtocolBufferException negativeSize() {
54 return new InvalidProtocolBufferException("""
55 CodedBufferReader encountered an embedded string or message
56 which claimed to have negative size.
57 """
58 );
59 }
60
61 static InvalidProtocolBufferException recursionLimitExceeded() {
62 return new InvalidProtocolBufferException("""
63 Protocol message had too many levels of nesting. May be malicious.
64 Use CodedBufferReader.setRecursionLimit() to increase the depth limit.
65 """
66 );
67 }
68
69 static InvalidProtocolBufferException sizeLimitExceeded() {
70 return new InvalidProtocolBufferException("""
71 Protocol message was too large. May be malicious.
72 Use CodedBufferReader.setSizeLimit() to increase the size limit.
73 """
74 );
75 }
76
77 static InvalidProtocolBufferException truncatedMessage() {
78 return new InvalidProtocolBufferException("""
79 While parsing a protocol message, the input ended unexpectedly
80 in the middle of a field. This could mean either than the
81 input has been truncated or that an embedded message
82 misreported its own length.
83 """
84 );
85 }
86 }
OLDNEW
« no previous file with comments | « lib/protobuf/runtime/PbCodec.dart ('k') | lib/protobuf/runtime/PbImmutableList.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698