Skip to content

Commit

Permalink
fix: some wrong ideas on type
Browse files Browse the repository at this point in the history
  • Loading branch information
aldy505 committed May 28, 2023
1 parent faac653 commit 2d461d7
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions application/repositories/UserClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export class UserClient implements IUserRepository {
throw new NotFoundError(`${username} was not found`);
}

let user: User;
let user: User | undefined;
for (const row of rows) {
if (row === undefined) throw new NotFoundError(`${username} returned null`);

Expand All @@ -93,6 +93,8 @@ export class UserClient implements IUserRepository {

await connection.query("COMMIT");

if (user === undefined) throw new NotFoundError(`${username} was not found`)

return user;
} catch (error: unknown) {
await connection.query("ROLLBACK");
Expand Down Expand Up @@ -127,7 +129,7 @@ export class UserClient implements IUserRepository {

const users: User[] = [];
for (const row of rows) {
if (row === undefined) throw new NotFoundError(`${username} returned null`);
if (row === undefined) continue;

const user = new User(
row.github_id,
Expand Down

0 comments on commit 2d461d7

Please sign in to comment.