Log exception and return "Not Available" when trade role cannot be found

This commit is contained in:
ghubstan 2022-01-25 12:21:22 -03:00
parent 210d966702
commit 4ab4c3d213
No known key found for this signature in database
GPG Key ID: E35592D6800A861E

View File

@ -270,9 +270,14 @@ class CoreTradesService {
coreWalletsService.verifyWalletsAreAvailable();
coreWalletsService.verifyEncryptedWalletIsUnlocked();
var isBsqSwapTrade = tradeModel instanceof BsqSwapTrade;
return isBsqSwapTrade
? tradeUtil.getRole((BsqSwapTrade) tradeModel)
: tradeUtil.getRole((Trade) tradeModel);
try {
return isBsqSwapTrade
? tradeUtil.getRole((BsqSwapTrade) tradeModel)
: tradeUtil.getRole((Trade) tradeModel);
} catch (Exception ex) {
log.error("Role not found for trade with Id {}.", tradeModel.getId(), ex);
return "Not Available";
}
}
Trade getTrade(String tradeId) {