Skip to content

Commit db3e7aa

Browse files
authored
Refactor error handling in LdapDirectoryService to ensure proper unbinding and error propagation (#995)
1 parent 9a2168c commit db3e7aa

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/services/directory-services/ldap-directory.service.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,12 @@ export class LdapDirectoryService implements IDirectoryService {
6868
}
6969
groups = await this.getGroups(groupForce);
7070
}
71-
} finally {
71+
} catch (e) {
7272
await this.client.unbind();
73+
throw e;
7374
}
7475

76+
await this.client.unbind();
7577
return [groups, users];
7678
}
7779

@@ -453,8 +455,9 @@ export class LdapDirectoryService implements IDirectoryService {
453455

454456
try {
455457
await this.client.bind(user, pass);
456-
} catch {
458+
} catch (error) {
457459
await this.client.unbind();
460+
throw error;
458461
}
459462
}
460463

0 commit comments

Comments
 (0)