Skip to content

Commit

Permalink
fix: replaced 400 error with 422
Browse files Browse the repository at this point in the history
  • Loading branch information
pranavkparti authored and joonaun93 committed Sep 16, 2023
1 parent f3792ee commit b54b9b8
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions server/repositories/WalletRepository.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,9 @@ class WalletRepository extends BaseRepository {
}

async getByName(wallet) {
try {
Joi.assert(wallet, Joi.string().pattern(/^\S+$/));
} catch (error) {
throw new HttpError(400, `invalid wallet name:${wallet}`);
}
Joi.assert(wallet, Joi.string().pattern(/^\S+$/).messages({
'string.pattern.base': `Invalid wallet name: "${wallet}"`
}) );

const list = await this._session
.getDB()
Expand Down

0 comments on commit b54b9b8

Please sign in to comment.