git.delta.rocks / unique-network / refs/commits / 4a02655589a8

difftreelog

feat catch dispatchError in playgrounds

Daniel Shiposha2022-10-06parent: #a693ced.patch.diff
in: master

2 files changed

modifiedtests/src/util/playgrounds/types.tsdiffbeforeafterboth
--- a/tests/src/util/playgrounds/types.ts
+++ b/tests/src/util/playgrounds/types.ts
@@ -14,6 +14,7 @@
 export interface ITransactionResult {
   status: 'Fail' | 'Success';
   result: {
+      dispatchError: any,
       events: {
         phase: any, // {ApplyExtrinsic: number} | 'Initialization',
         event: IEvent;
@@ -47,6 +48,7 @@
   call: string;
   params: any[];
   moduleError?: string;
+  dispatchError?: any;
   events?: any;
 }
 
modifiedtests/src/util/playgrounds/unique.tsdiffbeforeafterboth
514 params,514 params,
515 } as IUniqueHelperLog;515 } as IUniqueHelperLog;
516516
517 if(result.status !== this.transactionStatus.SUCCESS && result.moduleError) log.moduleError = result.moduleError;517 if(result.status !== this.transactionStatus.SUCCESS) {
518 if (result.moduleError) log.moduleError = result.moduleError;
519 else if (result.result.dispatchError) log.dispatchError = result.result.dispatchError;
520 }
518 if(events.length > 0) log.events = events;521 if(events.length > 0) log.events = events;
519522
520 this.chainLog.push(log);523 this.chainLog.push(log);
521524
522 if(expectSuccess && result.status !== this.transactionStatus.SUCCESS) throw Error(`${result.moduleError}`);525 if(expectSuccess && result.status !== this.transactionStatus.SUCCESS) {
526 if (result.moduleError) throw Error(`${result.moduleError}`);
527 else if (result.result.dispatchError) throw Error(JSON.stringify(result.result.dispatchError));
528 }
523 return result;529 return result;
524 }530 }
525531