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