github.com/Microsoft/azure-vhd-utils@v0.0.0-20230613175315-7c30a3748a1b/vhdcore/bat/blockAllocationTableParseError.go (about) 1 package bat 2 3 import "fmt" 4 5 // BlockAllocationTableParseError is the error type representing BAT parse error. 6 // 7 type BlockAllocationTableParseError struct { 8 BATItemIndex uint32 9 err error 10 } 11 12 // Error returns the string representation of the BlockAllocationTableParseError instance. 13 // 14 func (e *BlockAllocationTableParseError) Error() string { 15 return fmt.Sprintf("Parse BAT entry at '%d' failed: "+e.err.Error(), e.BATItemIndex) 16 } 17 18 // GetInnerErr returns the inner error, this method satisfies InnerErr interface 19 // 20 func (e *BlockAllocationTableParseError) GetInnerErr() error { 21 return e.err 22 } 23 24 // NewBlockAllocationTableParseError returns a new BlockAllocationTableParseError instance. 25 // The parameter batItemIndex represents BAT index failed to parse 26 // The parameter err is the underlying error for parse failure. 27 // 28 func NewBlockAllocationTableParseError(batItemIndex uint32, err error) error { 29 return &BlockAllocationTableParseError{ 30 BATItemIndex: batItemIndex, 31 err: err, 32 } 33 }