Skip to content

Commit 54825e2

Browse files
committed
Added error checking and derivedFrom on registers
Closes rust-embedded#18 Closes rust-embedded#21
1 parent fd65485 commit 54825e2

File tree

5 files changed

+310
-217
lines changed

5 files changed

+310
-217
lines changed

Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ version = "0.5.0"
1010

1111
[dependencies]
1212
xmltree = "0.3.2"
13+
error-chain = "0.7.2"

generate-tests.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ EOF
4949
fn $device() {
5050
let xml = include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/$device_path"));
5151
52-
svd::parse(xml);
52+
svd::parse(xml).unwrap();
5353
}
5454
EOF
5555
done

src/errors.rs

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
use xmltree;
2+
use std::str;
3+
use std::num;
4+
error_chain! {
5+
foreign_links {
6+
XmlParseError(xmltree::ParseError);
7+
StrParseBoolError(str::ParseBoolError);
8+
NumParseIntError(num::ParseIntError);
9+
10+
}
11+
errors {
12+
MissingMandatory(t: String) {
13+
description("mandatory element missing")
14+
display("mandatory element missing: ´{}´", t)
15+
}
16+
}
17+
}

0 commit comments

Comments
 (0)