1use std::io;
4use std::num::ParseIntError;
5
6use quick_error::quick_error;
7
8quick_error! {
10 #[derive(Debug)]
11 pub enum FitsError {
12 Io(err: io::Error) {
14 from()
15 display("I/O error: {}", err)
16 }
17 UnexpectedKeyword(expected: String, actual: String) {
18 display("Wrong keyword. Expected: '{}'. Actual: '{}'.", expected, actual)
19 }
20 ValueIndicatorNotFound(keyword_record: String) {
21 display("Value indicator not found in keyword record '{}'.", keyword_record)
22 }
23 UnexpectedValue(keyword: String, expected: String, actual: String) {
24 display("Wrong value for keyword '{}'. Expected: '{}'. Actual: '{}'.", keyword, expected, actual)
25 }
26 UintValueNotFound(keyword_record: String) {
27 display("Unsigned int value not found in keyword record '{}'.", keyword_record)
28 }
29 StringValueNotFound(keyword_record: String) {
30 display("String value no found in keyword record '{}'", keyword_record)
31 }
32 WrongUintValue(context: String, err: ParseIntError) {
33 context(context: String, err: ParseIntError) -> (context, err)
34 display("Parse {} error: {}", context, err)
35 }
36 MultipleKeyword(keyword: String) {
37 display("FITS not valid. Multiple Keyword '{}'", keyword)
38 }
39 MissingKeyword(keyword: String) {
40 display("Missing keyword '{}'", keyword)
41 }
42 UncompatibleKeywordContent(keyword1: String, keyword2: String) {
43 display("Incompatible keyword values for {} and {}", keyword1, keyword2)
44 }
45 RemainingData {
46 display("More data than the expected!")
47 }
48 PrematureEndOfData {
49 display("Less data than expected!")
50 }
51 UnexpectedWrittenSize {
52 display("Unexpected number of data written!")
53 }
54 UnexpectedDepth(depth: u8, depth_max: u8) {
55 display("unexpected depth. Max expected: {}. Actual: {}", depth_max, depth)
56 }
57 Custom(msg: String) {
58 display("FITS not valid: '{}'", msg)
59 }
60 }
61}