MCPcopy Index your code
hub / github.com/simstudioai/sim / handleBodySizeLimitError

Function handleBodySizeLimitError

apps/sim/tools/index.ts:744–755  ·  view source on GitHub ↗

* Handles body size limit errors by logging and throwing a user-friendly error * @param error - The original error * @param requestId - Request ID for logging * @param context - Context string for logging (e.g., toolId) * @throws Error with user-friendly message if it's a size limit error * @re

(error: unknown, requestId: string, context: string)

Source from the content-addressed store, hash-verified

742 * @returns false if not a size limit error (caller should continue handling)
743 */
744function handleBodySizeLimitError(error: unknown, requestId: string, context: string): boolean {
745 const errorMessage = toError(error).message
746
747 if (isBodySizeLimitError(errorMessage)) {
748 logger.error(`[${requestId}] Request body size limit exceeded for ${context}:`, {
749 originalError: errorMessage,
750 })
751 throw new Error(BODY_SIZE_LIMIT_ERROR_MESSAGE)
752 }
753
754 return false
755}
756
757function handleResponseSizeLimitError(error: unknown, requestId: string, context: string): boolean {
758 if (!isPayloadSizeLimitError(error)) return false

Callers 1

executeToolRequestFunction · 0.85

Calls 3

toErrorFunction · 0.90
isBodySizeLimitErrorFunction · 0.85
errorMethod · 0.80

Tested by

no test coverage detected