Skip to content

Commit

Permalink
fix: Use http BadRequest (400) when balance-info not found (#355)
Browse files Browse the repository at this point in the history
  • Loading branch information
emostov committed Dec 9, 2020
1 parent 692193d commit c2a4937
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
8 changes: 3 additions & 5 deletions src/services/accounts/AccountsBalanceInfoService.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { BlockHash } from '@polkadot/types/interfaces';
import { BadRequest } from 'http-errors';
import { IAccountBalanceInfo } from 'src/types/responses';

import { AbstractService } from '../AbstractService';
Expand Down Expand Up @@ -29,7 +30,7 @@ export class AccountsBalanceInfoService extends AbstractService {

const at = {
hash,
height: header.number.toNumber().toString(10),
height: header.number.unwrap().toString(10),
};

if (account && locks && sysAccount) {
Expand All @@ -46,10 +47,7 @@ export class AccountsBalanceInfoService extends AbstractService {
locks,
};
} else {
throw {
at,
error: 'Account not found',
};
throw new BadRequest('Account not found');
}
}
}
2 changes: 1 addition & 1 deletion src/services/accounts/AccountsVestingInfoService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export class AccountsVestingInfoService extends AbstractService {

const at = {
hash,
height: number.toNumber().toString(10),
height: number.unwrap().toString(10),
};

return {
Expand Down

0 comments on commit c2a4937

Please sign in to comment.