Skip to content

Commit

Permalink
fix: Remove throw from getByName (#97)
Browse files Browse the repository at this point in the history
  • Loading branch information
santese authored May 13, 2022
1 parent 3e7060f commit 7ed6437
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/lib/clients/clients.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,9 @@ export class Clients {
return data
}

async getByName(clientName: string): Promise<TimelyClient> {
async getByName(clientName: string): Promise<TimelyClient | undefined> {
const clients = await this.getAll()
const client = clients.find((c) => c.name === clientName)
if (!client) throw new Error(`Can't find client with name of ${clientName}`)
return client
return clients.find((c) => c.name === clientName)
}

async getByExternalId(customerId: string): Promise<TimelyClient | undefined> {
Expand Down

0 comments on commit 7ed6437

Please sign in to comment.