File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -498,25 +498,29 @@ export class DBClient {
498498 * @param {string[] } cids
499499 */
500500 async getDealsForCids ( cids = [ ] ) {
501- const rsp = await this . client . rpc ( 'find_deals_by_content_cids' , {
502- cids,
503- } )
504- if ( rsp . error ) {
505- return { }
506- }
501+ try {
502+ const rsp = await this . client . rpc ( 'find_deals_by_content_cids' , {
503+ cids,
504+ } )
505+ if ( rsp . error ) {
506+ throw new DBError ( rsp . error )
507+ }
507508
508- /** @type {Record<string, import('./../bindings').Deal[]> } */
509- const result = { }
510- for ( const d of rsp . data ) {
511- const { contentCid : cid , ...rest } = d
512- if ( ! Array . isArray ( result [ cid ] ) ) {
513- result [ cid ] = [ rest ]
514- } else {
515- result [ cid ] . push ( rest )
509+ /** @type {Record<string, import('./../bindings').Deal[]> } */
510+ const result = { }
511+ for ( const d of rsp . data ) {
512+ const { contentCid : cid , ...rest } = d
513+ if ( ! Array . isArray ( result [ cid ] ) ) {
514+ result [ cid ] = [ rest ]
515+ } else {
516+ result [ cid ] . push ( rest )
517+ }
516518 }
517- }
518519
519- return result
520+ return result
521+ } catch ( err ) {
522+ return { }
523+ }
520524 }
521525
522526 /**
You can’t perform that action at this time.
0 commit comments