@@ -8,7 +8,8 @@ use std::{
8
8
use miette:: Diagnostic ;
9
9
#[ cfg( feature = "serialport" ) ]
10
10
use slip_codec:: SlipError ;
11
- use strum:: { FromRepr , VariantNames } ;
11
+ #[ cfg( feature = "serialpot" ) ]
12
+ use strum:: FromRepr ;
12
13
use thiserror:: Error ;
13
14
14
15
#[ cfg( feature = "cli" ) ]
@@ -184,6 +185,7 @@ pub enum Error {
184
185
InvalidElf ( #[ from] ElfError ) ,
185
186
186
187
#[ error( "The bootloader returned an error" ) ]
188
+ #[ cfg( feature = "serialpot" ) ]
187
189
#[ diagnostic( transparent) ]
188
190
RomError ( #[ from] RomError ) ,
189
191
@@ -351,6 +353,7 @@ impl From<CommandType> for TimedOutCommand {
351
353
#[ derive( Clone , Copy , Debug , Default , Diagnostic , Error , FromRepr ) ]
352
354
#[ non_exhaustive]
353
355
#[ repr( u8 ) ]
356
+ #[ cfg( feature = "serialpot" ) ]
354
357
pub enum RomErrorKind {
355
358
#[ error( "Invalid message received" ) ]
356
359
#[ diagnostic( code( espflash:: rom:: invalid_message) ) ]
@@ -426,6 +429,7 @@ pub enum RomErrorKind {
426
429
Other = 0xff ,
427
430
}
428
431
432
+ #[ cfg( feature = "serialpot" ) ]
429
433
impl From < u8 > for RomErrorKind {
430
434
fn from ( raw : u8 ) -> Self {
431
435
Self :: from_repr ( raw) . unwrap_or_default ( )
@@ -435,13 +439,15 @@ impl From<u8> for RomErrorKind {
435
439
/// An error originating from a device's ROM functionality
436
440
#[ derive( Clone , Copy , Debug , Diagnostic , Error ) ]
437
441
#[ error( "Error while running {command} command" ) ]
442
+ #[ cfg( feature = "serialpot" ) ]
438
443
#[ non_exhaustive]
439
444
pub struct RomError {
440
445
command : CommandType ,
441
446
#[ source]
442
447
kind : RomErrorKind ,
443
448
}
444
449
450
+ #[ cfg( feature = "serialpot" ) ]
445
451
impl RomError {
446
452
pub fn new ( command : CommandType , kind : RomErrorKind ) -> RomError {
447
453
RomError { command, kind }
0 commit comments