Contain a throw from the application's logger instead of letting it escape

This commit is contained in:
2026-09-04 11:33:20 +02:00
parent 80530c6265
commit 2e422c7584
5 changed files with 51 additions and 10 deletions
+2 -2
View File
@@ -11,7 +11,7 @@ import { checkSessionOptions, undeclaredInterfaceVersion } from './session-optio
import { connect as netConnect } from 'node:net';
import { connect as tlsConnect } from 'node:tls';
import { defaultInterfaceVersion } from './defs/constants.ts';
import { silentLog } from './log.ts';
import { guardedLog } from './log.ts';
export type ClientOptions = {
addressRange?: string;
@@ -194,7 +194,7 @@ async function connect(options: ClientOptions, log: SmppLog): Promise<Result<{ s
/** Connects to an SMSC and binds. */
export async function client(options: ClientOptions = {}): Promise<Result<{ session: Session }>> {
const log = options.log ?? silentLog;
const log = guardedLog(options.log);
const opened = await connect(options, log);
if (opened.err) return { err: opened.err };