Skip to content

Commit c69d738

Browse files
committed
---
yaml --- r: 153979 b: refs/heads/try2 c: 5bd8edc h: refs/heads/master i: 153977: 7464aed 153975: 260c2dd v: v3
1 parent b077c42 commit c69d738

File tree

4 files changed

+20
-7
lines changed

4 files changed

+20
-7
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: b495933a7fdc5e7b28ddbb058d1e2dab330ace7b
8+
refs/heads/try2: 5bd8edc1121a5736994d69b2dc9cf3efb6fbc116
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/src/librbml/lib.rs

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,8 @@ pub enum EbmlEncoderTag {
105105
pub enum Error {
106106
IntTooBig(uint),
107107
Expected(String),
108-
IoError(std::io::IoError)
108+
IoError(std::io::IoError),
109+
ApplicationError(String)
109110
}
110111
// --------------------------------------
111112

@@ -119,11 +120,11 @@ pub mod reader {
119120

120121
use serialize;
121122

122-
use super::{ EsVec, EsMap, EsEnum, EsVecLen, EsVecElt, EsMapLen, EsMapKey,
123-
EsEnumVid, EsU64, EsU32, EsU16, EsU8, EsInt, EsI64, EsI32, EsI16, EsI8,
124-
EsBool, EsF64, EsF32, EsChar, EsStr, EsMapVal, EsEnumBody, EsUint,
125-
EsOpaque, EsLabel, EbmlEncoderTag, Doc, TaggedDoc, Error, IntTooBig,
126-
Expected };
123+
use super::{ ApplicationError, EsVec, EsMap, EsEnum, EsVecLen, EsVecElt,
124+
EsMapLen, EsMapKey, EsEnumVid, EsU64, EsU32, EsU16, EsU8, EsInt, EsI64,
125+
EsI32, EsI16, EsI8, EsBool, EsF64, EsF32, EsChar, EsStr, EsMapVal,
126+
EsEnumBody, EsUint, EsOpaque, EsLabel, EbmlEncoderTag, Doc, TaggedDoc,
127+
Error, IntTooBig, Expected };
127128

128129
pub type DecodeResult<T> = Result<T, Error>;
129130
// rbml reading
@@ -636,6 +637,10 @@ pub mod reader {
636637
debug!("read_map_elt_val(idx={})", idx);
637638
self.push_doc(EsMapVal, f)
638639
}
640+
641+
fn error(&mut self, err: &str) -> Error {
642+
ApplicationError(err.to_string())
643+
}
639644
}
640645
}
641646

branches/try2/src/libserialize/json.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,7 @@ pub enum DecoderError {
257257
ExpectedError(String, String),
258258
MissingFieldError(String),
259259
UnknownVariantError(String),
260+
ApplicationError(String)
260261
}
261262

262263
/// Returns a readable error string for a given error code.
@@ -2071,6 +2072,10 @@ impl ::Decoder<DecoderError> for Decoder {
20712072
debug!("read_map_elt_val(idx={})", idx);
20722073
f(self)
20732074
}
2075+
2076+
fn error(&mut self, err: &str) -> DecoderError {
2077+
ApplicationError(err.to_string())
2078+
}
20742079
}
20752080

20762081
/// A trait for converting values to JSON

branches/try2/src/libserialize/serialize.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,9 @@ pub trait Decoder<E> {
163163
fn read_map<T>(&mut self, f: |&mut Self, uint| -> Result<T, E>) -> Result<T, E>;
164164
fn read_map_elt_key<T>(&mut self, idx: uint, f: |&mut Self| -> Result<T, E>) -> Result<T, E>;
165165
fn read_map_elt_val<T>(&mut self, idx: uint, f: |&mut Self| -> Result<T, E>) -> Result<T, E>;
166+
167+
// Failure
168+
fn error(&mut self, err: &str) -> E;
166169
}
167170

168171
pub trait Encodable<S:Encoder<E>, E> {

0 commit comments

Comments
 (0)