Skip to content

Commit

Permalink
fix: remove unnecesary try-catch
Browse files Browse the repository at this point in the history
  • Loading branch information
0xyaco committed Oct 31, 2024
1 parent 6431356 commit 9f88af3
Showing 1 changed file with 3 additions and 14 deletions.
17 changes: 3 additions & 14 deletions packages/automated-dispute/src/services/prophetCodec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -237,21 +237,10 @@ export class ProphetCodec {
* @returns The DisputeStatus string corresponding to the input value.
*/
static decodeDisputeStatus(status: number): DisputeStatus {
let disputeStatus: DisputeStatus | undefined;
const disputeStatus: DisputeStatus | undefined = DISPUTE_STATUS_ENUM[status];

try {
disputeStatus = DISPUTE_STATUS_ENUM[status];
} catch (err) {
throw new ProphetDecodingError(
"dispute.status",
toHex(status.toString()),
err instanceof Error ? err : undefined,
);
}

if (!disputeStatus)
throw new ProphetDecodingError("dispute.status", toHex(status.toString()));
else return disputeStatus;
if (disputeStatus) return disputeStatus;
else throw new ProphetDecodingError("dispute.status", toHex(status.toString()));
}

/**
Expand Down

0 comments on commit 9f88af3

Please sign in to comment.