@@ -115,7 +115,7 @@ func (d *delegation) Attach(b block.Block) error {
115115func NewDelegation (root ipld.Block , bs blockstore.BlockReader ) (Delegation , error ) {
116116 ucan , err := decode (root )
117117 if err != nil {
118- return nil , fmt .Errorf ("decoding UCAN: %s " , err )
118+ return nil , fmt .Errorf ("decoding UCAN: %w " , err )
119119 }
120120 attachments , err := blockstore .NewBlockStore ()
121121 if err != nil {
@@ -127,7 +127,7 @@ func NewDelegation(root ipld.Block, bs blockstore.BlockReader) (Delegation, erro
127127func NewDelegationView (root ipld.Link , bs blockstore.BlockReader ) (Delegation , error ) {
128128 blk , ok , err := bs .Get (root )
129129 if err != nil {
130- return nil , fmt .Errorf ("getting delegation root block: %s " , err )
130+ return nil , fmt .Errorf ("getting delegation root block: %w " , err )
131131 }
132132 if ! ok {
133133 return nil , fmt .Errorf ("missing delegation root block: %s" , root )
@@ -201,20 +201,20 @@ func Archive(d Delegation) io.Reader {
201201 )
202202 if err != nil {
203203 reader , _ := io .Pipe ()
204- reader .CloseWithError (fmt .Errorf ("hashing variant block bytes: %s " , err ))
204+ reader .CloseWithError (fmt .Errorf ("hashing variant block bytes: %w " , err ))
205205 return reader
206206 }
207207 // Create a new reader that contains the new block as well as the others.
208208 blks , err := blockstore .NewBlockStore (blockstore .WithBlocksIterator (d .Blocks ()))
209209 if err != nil {
210210 reader , _ := io .Pipe ()
211- reader .CloseWithError (fmt .Errorf ("creating new block reader: %s " , err ))
211+ reader .CloseWithError (fmt .Errorf ("creating new block reader: %w " , err ))
212212 return reader
213213 }
214214 err = blks .Put (variant )
215215 if err != nil {
216216 reader , _ := io .Pipe ()
217- reader .CloseWithError (fmt .Errorf ("adding variant block: %s " , err ))
217+ reader .CloseWithError (fmt .Errorf ("adding variant block: %w " , err ))
218218 return reader
219219 }
220220 return car .Encode ([]ipld.Link {variant .Link ()}, blks .Iterator ())
@@ -234,15 +234,15 @@ func Extract(b []byte) (Delegation, error) {
234234
235235 br , err := blockstore .NewBlockReader (blockstore .WithBlocksIterator (blks ))
236236 if err != nil {
237- return nil , fmt .Errorf ("creating block reader: %s " , err )
237+ return nil , fmt .Errorf ("creating block reader: %w " , err )
238238 }
239239
240240 rt , ok , err := br .Get (roots [0 ])
241241 if err != nil {
242- return nil , fmt .Errorf ("getting root block: %s " , err )
242+ return nil , fmt .Errorf ("getting root block: %w " , err )
243243 }
244244 if ! ok {
245- return nil , fmt .Errorf ("missing root block: %d " , len ( roots ) )
245+ return nil , fmt .Errorf ("missing root block: %s " , roots [ 0 ] )
246246 }
247247
248248 model := adm.ArchiveModel {}
@@ -254,7 +254,7 @@ func Extract(b []byte) (Delegation, error) {
254254 sha256 .Hasher ,
255255 )
256256 if err != nil {
257- return nil , fmt .Errorf ("decoding root block: %s " , err )
257+ return nil , fmt .Errorf ("decoding root block: %w " , err )
258258 }
259259
260260 return NewDelegationView (model .Ucan0_9_1 , br )
0 commit comments