Function
checkMessageLength
(
descriptor: Descriptor,
op: string,
markdown: string,
actions?: ReadonlyArray<Action> | undefined
)
Source from the content-addressed store, hash-verified
| 394 | * @since 4.1.5 |
| 395 | */ |
| 396 | export const checkMessageLength = ( |
| 397 | descriptor: Descriptor, |
| 398 | op: string, |
| 399 | markdown: string, |
| 400 | actions?: ReadonlyArray<Action> | undefined |
| 401 | ): Effect.Effect<void, ChatError> => |
| 402 | descriptor.measure(markdown, actions ?? []) <= descriptor.limits.messageLength ? Effect.void : Effect.fail( |
| 403 | new ChatError({ |
| 404 | platform: descriptor.platform, |
| 405 | op, |
| 406 | reason: new TooLarge({ subject: "text", detail: "message_too_long" }) |
| 407 | }) |
| 408 | ) |
| 409 | |
| 410 | const maxRetries = 3 |
| 411 | const baseDelay = Duration.millis(500) |
Tested by
no test coverage detected