Skip to content

Commit

Permalink
chore: make return more readable
Browse files Browse the repository at this point in the history
  • Loading branch information
gweiying committed Mar 18, 2024
1 parent 9c39135 commit e51acc4
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/server/repositories/UrlRepository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,10 @@ export class UrlRepository implements UrlRepositoryInterface {
) => {
try {
// Cache lookup
await this.getLongUrlFromCache(shortUrl)
// if long url does not exist, throws error
const longUrl = await this.getLongUrlFromCache(shortUrl)
return !longUrl
// return false if no error since long url exists
return false
} catch {
// Cache failed, look in database
const url = await Url.findOne({
Expand Down

0 comments on commit e51acc4

Please sign in to comment.