Let sendSms() name the esm_class messaging mode (#92)
* Regression tests for the messaging mode on sendSms() * Let sendSms() name the esm_class messaging mode * Document the messaging mode option and the decision behind it * Name the constants move for migrating consumers and share the refusal's value naming * Cover the messaging-mode refusals through submitSms() * Refuse transaction mode and a report under datagram mode on sendSms() * Narrow the mode checker and name the default mode once
This commit is contained in:
@@ -10,6 +10,7 @@ import type { Sms } from './sms.ts';
|
||||
import type { Socket } from 'node:net';
|
||||
import { backoffDefaults } from './reconnect-loop.ts';
|
||||
import { isSmsIdNotation, smsIdNotations, smsIdPlaces } from './sms-id.ts';
|
||||
import { namedValue } from './error-from.ts';
|
||||
|
||||
export type SessionEvents = {
|
||||
close: [];
|
||||
@@ -227,8 +228,7 @@ function checkSmsIdFormat(smsIdFormat: unknown): VoidResult {
|
||||
|
||||
if (notation === undefined || isSmsIdNotation(notation)) continue;
|
||||
|
||||
// String() throws on a null-prototype object, and this value is whatever the caller passed.
|
||||
const got = typeof notation === 'string' ? notation : typeof notation;
|
||||
const got = namedValue(notation);
|
||||
|
||||
return { err: new Error(`smsIdFormat.${place} must be ${smsIdNotations.join(' or ')}, got ${got}`) };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user