Skip to content

Commit

Permalink
fix: return 404 when countries not found
Browse files Browse the repository at this point in the history
  • Loading branch information
dadiorchen committed Jan 28, 2022
1 parent 79ebc61 commit 4f1cecb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion server/infra/database/CountryRepository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export default class CountryRepository extends BaseRepository<Country> {
const object = await this.session
.getDB()
.raw(sql);
if (!object && object.rows.length !== 1) {
if (!object || object.rows.length <= 0) {
throw new HttpError(404, `Can not found ${this.tableName} by lat:${lat} lon:${lon}`);
}
return object.rows;
Expand Down

0 comments on commit 4f1cecb

Please sign in to comment.