From 22dd7415e08daaabfa47b0109871de8dbbf932f3 Mon Sep 17 00:00:00 2001 From: FUJITA Yuki Date: Mon, 17 Jun 2024 10:49:24 +0900 Subject: [PATCH] print block address in an error message --- ext4/inode.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ext4/inode.go b/ext4/inode.go index 567e886..282d5e4 100644 --- a/ext4/inode.go +++ b/ext4/inode.go @@ -121,7 +121,7 @@ func resolveSingleIndirectBlockAddress(ext4 *FileSystem, singleIndirectBlockAddr singleIndirectBlockAddresses, err := readBlock(ext4.r, ext4.sb.GetBlockSize()) if err != nil { - return nil, xerrors.Errorf("failed to read directory entry: %w", err) + return nil, xerrors.Errorf("failed to read directory entry at block address %#x: %w", singleIndirectBlockAddress, err) } for singleIndirectBlockAddresses.Len() > 0 { @@ -145,7 +145,7 @@ func resolveDoubleIndirectBlockAddress(ext4 *FileSystem, doubleIndirectBlockAddr doubleIndirectBlockAddresses, err := readBlock(ext4.r, ext4.sb.GetBlockSize()) if err != nil { - return nil, xerrors.Errorf("failed to read directory entry: %w", err) + return nil, xerrors.Errorf("failed to read directory entry at block address %#x: %w", doubleIndirectBlockAddress, err) } for doubleIndirectBlockAddresses.Len() > 0 { @@ -174,7 +174,7 @@ func resolveTripleIndirectBlockAddress(ext4 *FileSystem, tripleIndirectBlockAddr tripleIndirectBlockAddresses, err := readBlock(ext4.r, ext4.sb.GetBlockSize()) if err != nil { - return nil, xerrors.Errorf("failed to read directory entry: %w", err) + return nil, xerrors.Errorf("failed to read directory entry at block address %#x: %w", tripleIndirectBlockAddress, err) } for tripleIndirectBlockAddresses.Len() > 0 {