Skip to content

Commit

Permalink
feat: add rgbpp transaction job failedReason
Browse files Browse the repository at this point in the history
  • Loading branch information
ahonn committed Mar 27, 2024
1 parent e4ec1ea commit bffc7a2
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/routes/rgbpp/transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ const transactionRoute: FastifyPluginCallback<Record<never, never>, Server, ZodT
response: {
200: z.object({
state: z.string().describe('The state of the transaction'),
failedReason: z.string().optional().describe('The reason why the transaction failed'),
}),
},
},
Expand All @@ -130,6 +131,12 @@ const transactionRoute: FastifyPluginCallback<Record<never, never>, Server, ZodT
return;
}
const state = await job.getState();
if (state === 'failed') {
return {
state,
failedReason: job.failedReason,
};
}
return { state };
},
);
Expand Down

0 comments on commit bffc7a2

Please sign in to comment.