1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
use crate::parser::ParseError;
/// SCPI error
#[derive(Debug, Clone, Copy, PartialEq)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Error {
/// A custom error, consisting of an error number and a name.
Custom(i16, &'static str),
/// Command error (-100)
///
/// This is the generic syntax error for devices that cannot detect more
/// specific errors. This code indicates only that a Command Error as
/// defined in IEEE 488.2, 11.5.1.1.4 has occurred.
CommandError,
/// Invalid character (-101)
///
/// A syntactic element contains a character which is invalid for that type;
/// for example, a header containing an ampersand, SETUP&. This error
/// might be used in place of errors [Error::HeaderSuffixOutOfRange],
/// [Error::InvalidCharacterInNumber], [Error::InvalidCharacterData], and
/// perhaps some others.
InvalidCharacter,
/// Syntax error (-102)
///
/// An unrecognized command or data type was encountered; for example, a
/// string was received when the device does not accept strings.
SyntaxError,
/// Invalid separator (-103)
///
/// The parser was expecting a separator and encountered an illegal
/// character; for example, the semicolon was omitted after a program
/// message unit, `*EMC 1:CH1:VOLTS 5.`
InvalidSeparator,
/// Data type error (-104)
///
/// The parser recognized a data element different than one allowed; for
/// example, numeric or string data was expected but block data was
/// encountered.
DataTypeError,
/// Get not allowed (-105)
///
/// A Group Execute Trigger was received within a program message (see IEEE
/// 488.2, 7.7).
GetNotAllowed,
/// Parameter not allowed (-108)
///
/// More parameters were received than expected for the header; for example,
/// the *EMC common command only accepts one parameter, so receiving `*EMC
/// 0,1` is not allowed.
ParameterNotAllowed,
/// Missing parameter (-109)
///
/// Fewer parameters were recieved than required for the header; for
/// example, the `*EMC` common command requires one parameter, so
/// receiving `*EMC` is not allowed.
MissingParameter,
/// Command header error (-110)
///
/// An error was detected in the header. This error message should be used
/// when the device cannot detect the more specific errors described for
/// errors -111 through -119.
CommandHeaderError,
/// Header separator error (-111)
///
/// A character which is not a legal header separator was encountered while
/// parsing the header; for example, no white shace followed the header,
/// thus `*GMC"MACRO"` is an error.
HeaderSeparatorError,
/// Program mnemonic too long (-112)
///
/// The header contains more that twelve characters (see IEEE 488.2,
/// 7.6.1.4.1).
ProgramMnemonicTooLong,
/// Undefined header (-113)
///
/// The header is syntactically correct, but it is undefined for this
/// specific device; for example, `*XYZ` is not defined for any device.
UndefinedHeader,
/// Header suffix out of range (-114)
///
/// The value of a numeric suffix attached to a program mnemonic, see Syntax
/// and Style section 6.2.5.2, makes the header invalid.
HeaderSuffixOutOfRange,
/// Unexpected number of parameters (-115)
///
/// The number of parameters received does not correspond to the number of
/// parameters expected.
UnexpectedNumberOfParameters,
/// Numeric data error (-120)
///
/// This error, as well as errors -121 through -129, are generated when
/// parsing a data element which apprears to be numeric, including the
/// nondecimal numeric types. This particular error message should be
/// used if the device cannot detect a more specific error.
NumericDataError,
/// Invalid character in number (-121)
///
/// An invalid character for the data type being parsed was encountered; for
/// example, an alpha in a decimal numeric or a `9` in octal data.
InvalidCharacterInNumber,
/// Exponent too large (-123)
///
/// The magnitude of the exponent was larger than 32000 (see IEEE 488.2,
/// 7.7.2.4.1).
ExponentTooLarge,
/// Too many digits (-124)
///
/// The mantissa of a decimal numeric data element contained more than 255
/// digits excluding leading zeros (see IEEE 488.2, 7.7.2.4.1).
TooManyDigits,
/// Numeric data not allowed (-128)
///
/// A legal numeric data element was received, but the device does not
/// accept one in this position for the header.
NumericDataNotAllowed,
/// Suffix error (-130)
///
/// This error, as well as errors -131 through -139, are generated when
/// parsing a suffix. This particular error message should be used if the
/// device cannot detect a more specific error.
SuffixError,
/// Invalid suffix (-131)
///
/// The suffix does not follow the syntax described in IEEE 488.2, 7.7.3.2,
/// or the suffix is inappropriate for this device.
InvalidSuffix,
/// Suffix too long (-134)
///
/// The suffix contained more than 12 characters (see IEEE 488.2, 7.7.3.4).
SuffixTooLong,
/// Suffix not allowed (-138)
///
/// A suffix was encountered after a numeric element which does not allow
/// suffixes.
SuffixNotAllowed,
/// Character data error (-140)
///
/// This error, as well as errors -141 through -149, are generated when
/// parsing a character data element. This particular error message
/// should be used if the device cannot detect a more specific error.
CharacterDataError,
/// Invalid character data (-141)
///
/// Either the character data element contains an invalid character or the
/// particular element received is not valid for the header.
InvalidCharacterData,
/// Character data too long (-144)
///
/// The character data element contains more than twelve characters (see
/// IEEE 488.2, 7.7.1.4).
CharacterDataTooLong,
/// Character not allowed (-148)
///
/// A legal character data element was encountered where prohibited by the
/// device.
CharacterNotAllowed,
/// String data error (-150)
///
/// This error, as well as errors -151 through -159, are generated when
/// parsing a string data element. This particular error message should
/// be used if the device cannot detect a more specific error.
StringDataError,
/// Invalid string data (-151)
///
/// A string data element was expected, but was invalid for some reason (see
/// IEEE 488.2, 7.7.5.2); for example, an END message was received before
/// the terminal quote character.
InvalidStringData,
/// String data not allowed (-158)
///
/// A string data element was encountered but was not allowed by the device
/// at this point in parsing.
StringDataNotAllowed,
/// Block data error (-160)
///
/// This error, as well as errors -161 through -169, are generated when
/// parsing a block data element. This particular error message should
/// be used if the device cannot detect a more specific error.
BlockDataError,
/// Invalid block data (-161)
///
/// A block data element was expected, but was invalid for some reason (see
/// IEEE 488.2, 7.7.6.2); for example, an END message was received
/// before the length was satisfied.
InvalidBlockData,
/// Block data not allowed (-168)
///
/// A legal block data element was encountered but was not allowed by the
/// device at this point in parsing.
BlockDataNotAllowed,
/// Expression error (-170)
///
/// This error, as well as errors -171 through -179, are generated when
/// parsing an expression data element. This particular error message
/// should be used if the device cannot detect a more specific error.
ExpressionError,
/// Invalid expression (-171)
///
/// The expression data element was invalid (see IEEE 488.2, 7.7.7.2); for
/// example, unmatched parentheses or an illegal character.
InvalidExpression,
/// Expression data not allowed (-178)
///
/// A legal expression data was encountered but was not allowed by the
/// device at this point in parsing.
ExpressionDataNotAllowed,
/// Execution error (-200)
///
/// This is the generic syntax error for devices that cannot detect more
/// specific errors. This code indicates only that an Execution Error as
/// defined in IEEE 488.2, 11.5.1.1.5 has occurred.
ExecutionError,
/// Invalid while in local (-201)
///
/// Indicates that a command is not executable while the device is in local
/// due to a hard local control (see IEEE 488.2, 5.6.1.5); for example,
/// a device with a rotary switch receives a message which would change
/// the switches state, but the device is in local so the message can
/// not be executed.
InvalidWhileInLocal,
/// Command protected (-203)
///
/// Indicates that a legal password-protected program command or query could
/// not be executed because the command was disabled.
CommandProtected,
/// Trigger error (-210)
///
/// Indicates that a GET, *TRG, or triggering signal was received and
/// recognized by the device but was ignored because of device timing
/// considerations; for example, the device was not ready to respond.
/// Note: a DT0 device always ignores GET and treats *TRG as a Command
/// Error.
TriggerError,
/// Parameter error (-220)
///
/// Indicates that a program data element related error occurred. This error
/// message should be used when the device cannot detect the more
/// specific errors described for errors -221 through -229.
ParameterError,
/// Settings conflict (-221)
///
/// Indicates that a legal program data element was parsed but could not be
/// executed due to the current device state (see IEEE 488.2, 6.4.5.3
/// and 11.5.1.1.5.)
SettingsConflict,
/// Data out of range (-222)
///
/// Indicates that a legal program data element was parsed but could not be
/// executed due to the current device state (see IEEE 488.2, 6.4.5.3
/// and 11.5.1.1.5.)
DataOutOfRange,
/// Too much data (-223)
///
/// Indicates that a legal program data element of block, expression, or
/// string type was received that contained more data than the device
/// could handle due to memory or related device-specific requirements.
TooMuchData,
/// Illegal parameter value (-224)
///
/// Used where exact value, from a list of possibles, was expected.
IllegalParameterValue,
/// Out of memory (-225)
///
/// The device has insufficent memory to perform the requested operation.
OutOfMemory,
/// Lists not same length (-226)
///
/// Attempted to use LIST structure having individual LIST’s of unequal
/// lengths.
ListsNotSameLength,
/// Data corrupt or stale (-230)
///
/// Possibly invalid data; new reading started but not completed since last
/// access.
DataCorruptOrStale,
/// Hardware Error (-240)
///
/// Indicates that a legal program command or query could not be executed
/// because of a hardware problem in the device. Definition of what
/// constitutes a hardware problem is completely device-specific. This
/// error message should be used when the device cannot detect the more
/// specific errors described for errors -241 through -249.
HardwareError,
/// Device specific error (-300)
///
/// This is the generic device-dependent error for devices that cannot
/// detect more specific errors. This code indicates only that a
/// Device-Dependent Error as defined in IEEE 488.2, 11.5.1.1.6 has
/// occurred.
DeviceSpecificError,
/// System error (-310)
///
/// Indicates that some error, termed "system error" by the device, has
/// occurred. This code is device-dependent.
SystemError,
/// Storage fault (-320)
///
/// Indicates that the firmware detected a fault when using data storage.
/// This error is not an indication of physical damage or failure of any
/// mass storage element.
StorageFault,
/// Self-test failed (-330)
SelfTestFailed,
/// Calibration failed (-340)
CalibrationFailed,
/// Queue overflow (-350)
///
/// A specific code entered into the queue in lieu of the code that caused
/// the error. This code indicates that there is no room in the queue
/// and an error occurred but was not recorded.
QueueOverflow,
/// Communication error (-360)
///
/// This is the generic communication error for devices that cannot detect
/// the more specific errors described for errors -361 through -363.
CommunicationError,
/// Input buffer overrun (-363)
///
/// Software or hardware input buffer on serial port overflows with data
/// caused by improper or nonexistent pacing.
InputBufferOverrun,
/// Timeout error (-365)
///
/// This is a generic device-dependent error.
TimeoutError,
/// Query error (-400)
///
/// This is the generic query error for devices that cannot detect more
/// specific errors. This code indicates only that a Query Error as
/// defined in IEEE 488.2, 11.5.1.1.7 and 6.3 has occurred.
QueryError,
}
impl Error {
/// Get the error number as defined in IEEE 488.2.
pub fn number(&self) -> i16 {
match self {
Error::Custom(number, _name) => *number,
Error::CommandError => -100,
Error::InvalidCharacter => -101,
Error::SyntaxError => -102,
Error::InvalidSeparator => -103,
Error::DataTypeError => -104,
Error::GetNotAllowed => -105,
Error::ParameterNotAllowed => -108,
Error::MissingParameter => -109,
Error::CommandHeaderError => -110,
Error::HeaderSeparatorError => -111,
Error::ProgramMnemonicTooLong => -112,
Error::UndefinedHeader => -113,
Error::HeaderSuffixOutOfRange => -114,
Error::UnexpectedNumberOfParameters => -115,
Error::NumericDataError => -120,
Error::InvalidCharacterInNumber => -121,
Error::ExponentTooLarge => -123,
Error::TooManyDigits => -124,
Error::NumericDataNotAllowed => -128,
Error::SuffixError => -130,
Error::InvalidSuffix => -131,
Error::SuffixTooLong => -134,
Error::SuffixNotAllowed => -138,
Error::CharacterDataError => -140,
Error::InvalidCharacterData => -141,
Error::CharacterDataTooLong => -144,
Error::CharacterNotAllowed => -148,
Error::StringDataError => -150,
Error::InvalidStringData => -151,
Error::StringDataNotAllowed => -158,
Error::BlockDataError => -160,
Error::InvalidBlockData => -161,
Error::BlockDataNotAllowed => -168,
Error::ExpressionError => -170,
Error::InvalidExpression => -171,
Error::ExpressionDataNotAllowed => -178,
Error::ExecutionError => -200,
Error::InvalidWhileInLocal => -201,
Error::CommandProtected => -203,
Error::ParameterError => -220,
Error::TriggerError => -210,
Error::SettingsConflict => -221,
Error::DataOutOfRange => -222,
Error::TooMuchData => -223,
Error::IllegalParameterValue => -224,
Error::OutOfMemory => -225,
Error::ListsNotSameLength => -226,
Error::DataCorruptOrStale => -230,
Error::HardwareError => -240,
Error::DeviceSpecificError => -300,
Error::SystemError => -310,
Error::StorageFault => -320,
Error::SelfTestFailed => -330,
Error::CalibrationFailed => -340,
Error::QueueOverflow => -350,
Error::CommunicationError => -360,
Error::InputBufferOverrun => -363,
Error::TimeoutError => -365,
Error::QueryError => -400,
}
}
}
impl From<Error> for &str {
fn from(error: Error) -> &'static str {
match error {
Error::Custom(_, name) => name,
Error::CommandError => "Command error",
Error::InvalidCharacter => "Invalid character",
Error::SyntaxError => "Syntax Error",
Error::UndefinedHeader => "Undefined header",
Error::HeaderSuffixOutOfRange => "Header suffix out of range",
Error::InvalidCharacterInNumber => "Invalid character in number",
Error::InvalidCharacterData => "Invalid character data",
Error::ExecutionError => "Execution error",
Error::QueryError => "Query error",
Error::UnexpectedNumberOfParameters => "Unexpected number of parameters",
Error::InvalidSeparator => "Invalid separator",
Error::DataTypeError => "Data type error",
Error::ParameterNotAllowed => "Parameter not allowed",
Error::MissingParameter => "Missing parameter",
Error::SystemError => "System error",
Error::QueueOverflow => "Queue overflow",
Error::CommandHeaderError => "Command header error",
Error::HeaderSeparatorError => "Header separator error",
Error::ProgramMnemonicTooLong => "Program mnemonic too long",
Error::NumericDataError => "Numeric data error",
Error::ExponentTooLarge => "Exponent too large",
Error::TooManyDigits => "Too many digits",
Error::NumericDataNotAllowed => "Numeric data not allowed",
Error::InvalidWhileInLocal => "Invalid while in local",
Error::CommandProtected => "Command protected",
Error::TriggerError => "Trigger error",
Error::ParameterError => "Parameter error",
Error::SettingsConflict => "Settings conflict",
Error::DataOutOfRange => "Data out of range",
Error::TooMuchData => "Too much data",
Error::IllegalParameterValue => "Illegal parameter value",
Error::HardwareError => "Hardware error",
Error::DeviceSpecificError => "Device specific error",
Error::StorageFault => "Storage fault",
Error::SelfTestFailed => "Self test failed",
Error::CalibrationFailed => "Calibration failed",
Error::CommunicationError => "Communication error",
Error::InputBufferOverrun => "Input buffer overrun",
Error::TimeoutError => "Timeout error",
Error::GetNotAllowed => "Get not allowed",
Error::SuffixError => "Suffix error",
Error::InvalidSuffix => "Invalid suffix",
Error::SuffixTooLong => "Suffix too long",
Error::SuffixNotAllowed => "Suffix not allowed",
Error::CharacterDataError => "Character data error",
Error::CharacterDataTooLong => "Character data too long",
Error::CharacterNotAllowed => "Character not allowed",
Error::StringDataError => "String data error",
Error::InvalidStringData => "Invalid string data",
Error::StringDataNotAllowed => "String data not allowed",
Error::BlockDataError => "Block data error",
Error::InvalidBlockData => "Invalid block data",
Error::BlockDataNotAllowed => "Block data not allowed",
Error::ExpressionError => "Expression error",
Error::InvalidExpression => "Invalid expression",
Error::ExpressionDataNotAllowed => "Expression data not allowed",
Error::OutOfMemory => "Out of memory",
Error::ListsNotSameLength => "Lists not same length",
Error::DataCorruptOrStale => "Data corrupt or stale",
}
}
}
impl core::fmt::Display for Error {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
write!(f, "{}", Into::<&str>::into(*self))
}
}
impl core::error::Error for Error {}
impl From<core::fmt::Error> for Error {
fn from(_value: core::fmt::Error) -> Self {
Error::QueryError
}
}
impl From<ParseError> for Error {
fn from(value: ParseError) -> Self {
match value {
ParseError::SoftError(error) => error.unwrap_or(Error::SyntaxError),
ParseError::FatalError(error) => error,
ParseError::Incomplete => Error::SyntaxError,
}
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_error_number() {
assert_eq!(Error::CommandError.number(), -100);
assert_eq!(Error::InvalidCharacter.number(), -101);
assert_eq!(Error::SyntaxError.number(), -102);
assert_eq!(Error::Custom(999, "Custom Error").number(), 999);
}
#[test]
fn test_error_display() {
assert_eq!(format!("{}", Error::CommandError), "Command error");
assert_eq!(format!("{}", Error::InvalidCharacter), "Invalid character");
assert_eq!(format!("{}", Error::SyntaxError), "Syntax Error");
assert_eq!(
format!("{}", Error::Custom(999, "Custom Error")),
"Custom Error"
);
}
#[test]
fn test_error_from_fmt_error() {
let fmt_error: core::fmt::Error = core::fmt::Error;
let error: Error = fmt_error.into();
assert_eq!(error, Error::QueryError);
}
#[test]
fn test_error_from_parse_error() {
let parse_error = ParseError::SoftError(Some(Error::SyntaxError));
let error: Error = parse_error.into();
assert_eq!(error, Error::SyntaxError);
let parse_error = ParseError::FatalError(Error::CommandError);
let error: Error = parse_error.into();
assert_eq!(error, Error::CommandError);
let parse_error = ParseError::Incomplete;
let error: Error = parse_error.into();
assert_eq!(error, Error::SyntaxError);
}
#[test]
fn test_error_to_str() {
assert_eq!(Into::<&str>::into(Error::CommandError), "Command error");
assert_eq!(
Into::<&str>::into(Error::InvalidCharacter),
"Invalid character"
);
assert_eq!(Into::<&str>::into(Error::SyntaxError), "Syntax Error");
assert_eq!(
Into::<&str>::into(Error::Custom(999, "Custom Error")),
"Custom Error"
);
}
#[test]
fn test_all_error_numbers() {
assert_eq!(Error::InvalidSeparator.number(), -103);
assert_eq!(Error::DataTypeError.number(), -104);
assert_eq!(Error::GetNotAllowed.number(), -105);
assert_eq!(Error::ParameterNotAllowed.number(), -108);
assert_eq!(Error::MissingParameter.number(), -109);
assert_eq!(Error::CommandHeaderError.number(), -110);
assert_eq!(Error::HeaderSeparatorError.number(), -111);
assert_eq!(Error::ProgramMnemonicTooLong.number(), -112);
assert_eq!(Error::UndefinedHeader.number(), -113);
assert_eq!(Error::HeaderSuffixOutOfRange.number(), -114);
assert_eq!(Error::UnexpectedNumberOfParameters.number(), -115);
assert_eq!(Error::NumericDataError.number(), -120);
assert_eq!(Error::InvalidCharacterInNumber.number(), -121);
assert_eq!(Error::ExponentTooLarge.number(), -123);
assert_eq!(Error::TooManyDigits.number(), -124);
assert_eq!(Error::NumericDataNotAllowed.number(), -128);
assert_eq!(Error::SuffixError.number(), -130);
assert_eq!(Error::InvalidSuffix.number(), -131);
assert_eq!(Error::SuffixTooLong.number(), -134);
assert_eq!(Error::SuffixNotAllowed.number(), -138);
assert_eq!(Error::CharacterDataError.number(), -140);
assert_eq!(Error::InvalidCharacterData.number(), -141);
assert_eq!(Error::CharacterDataTooLong.number(), -144);
assert_eq!(Error::CharacterNotAllowed.number(), -148);
assert_eq!(Error::StringDataError.number(), -150);
assert_eq!(Error::InvalidStringData.number(), -151);
assert_eq!(Error::StringDataNotAllowed.number(), -158);
assert_eq!(Error::BlockDataError.number(), -160);
assert_eq!(Error::InvalidBlockData.number(), -161);
assert_eq!(Error::BlockDataNotAllowed.number(), -168);
assert_eq!(Error::ExpressionError.number(), -170);
assert_eq!(Error::InvalidExpression.number(), -171);
assert_eq!(Error::ExpressionDataNotAllowed.number(), -178);
assert_eq!(Error::ExecutionError.number(), -200);
assert_eq!(Error::InvalidWhileInLocal.number(), -201);
assert_eq!(Error::CommandProtected.number(), -203);
assert_eq!(Error::TriggerError.number(), -210);
assert_eq!(Error::ParameterError.number(), -220);
assert_eq!(Error::SettingsConflict.number(), -221);
assert_eq!(Error::DataOutOfRange.number(), -222);
assert_eq!(Error::TooMuchData.number(), -223);
assert_eq!(Error::IllegalParameterValue.number(), -224);
assert_eq!(Error::OutOfMemory.number(), -225);
assert_eq!(Error::ListsNotSameLength.number(), -226);
assert_eq!(Error::DataCorruptOrStale.number(), -230);
assert_eq!(Error::HardwareError.number(), -240);
assert_eq!(Error::DeviceSpecificError.number(), -300);
assert_eq!(Error::SystemError.number(), -310);
assert_eq!(Error::StorageFault.number(), -320);
assert_eq!(Error::SelfTestFailed.number(), -330);
assert_eq!(Error::CalibrationFailed.number(), -340);
assert_eq!(Error::QueueOverflow.number(), -350);
assert_eq!(Error::CommunicationError.number(), -360);
assert_eq!(Error::InputBufferOverrun.number(), -363);
assert_eq!(Error::TimeoutError.number(), -365);
assert_eq!(Error::QueryError.number(), -400);
}
}