Skip to content

Commit 9f3aa34

Browse files
committed
---
yaml --- r: 127029 b: refs/heads/snap-stage3 c: 5bd8edc h: refs/heads/master i: 127027: a0999e2 v: v3
1 parent 3ecb335 commit 9f3aa34

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
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 7be8f0af0393dcdb077c2f6b1653836fd3fba235
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: b495933a7fdc5e7b28ddbb058d1e2dab330ace7b
4+
refs/heads/snap-stage3: 5bd8edc1121a5736994d69b2dc9cf3efb6fbc116
55
refs/heads/try: 502e4c045236682e9728539dc0d2b3d0b237f55c
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/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/snap-stage3/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/snap-stage3/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)