(
reply: { send(payload: unknown): unknown },
requestId: string,
err: unknown,
)
| 575 | } |
| 576 | |
| 577 | function sendMappedError( |
| 578 | reply: { send(payload: unknown): unknown }, |
| 579 | requestId: string, |
| 580 | err: unknown, |
| 581 | ): void { |
| 582 | if (err instanceof FsPathEscapesError) { |
| 583 | reply.send(errEnvelope(ErrorCode.FS_PATH_ESCAPES_SESSION, err.message, requestId)); |
| 584 | return; |
| 585 | } |
| 586 | if (err instanceof FsPathNotFoundError) { |
| 587 | reply.send(errEnvelope(ErrorCode.FS_PATH_NOT_FOUND, err.message, requestId)); |
| 588 | return; |
| 589 | } |
| 590 | if (err instanceof FsIsDirectoryError) { |
| 591 | reply.send(errEnvelope(ErrorCode.FS_IS_DIRECTORY, err.message, requestId)); |
| 592 | return; |
| 593 | } |
| 594 | if (err instanceof FsAlreadyExistsError) { |
| 595 | reply.send(errEnvelope(ErrorCode.FS_ALREADY_EXISTS, err.message, requestId)); |
| 596 | return; |
| 597 | } |
| 598 | if (err instanceof FsIsBinaryError) { |
| 599 | reply.send(errEnvelope(ErrorCode.FS_IS_BINARY, err.message, requestId)); |
| 600 | return; |
| 601 | } |
| 602 | if (err instanceof FsTooLargeError) { |
| 603 | reply.send(errEnvelope(ErrorCode.FS_TOO_LARGE, err.message, requestId)); |
| 604 | return; |
| 605 | } |
| 606 | if (err instanceof FsTooManyResultsError) { |
| 607 | reply.send(errEnvelope(ErrorCode.FS_TOO_MANY_RESULTS, err.message, requestId)); |
| 608 | return; |
| 609 | } |
| 610 | if (err instanceof FsGrepTimeoutError) { |
| 611 | reply.send(errEnvelope(ErrorCode.FS_GREP_TIMEOUT, err.message, requestId)); |
| 612 | return; |
| 613 | } |
| 614 | if (err instanceof FsGitUnavailableError) { |
| 615 | reply.send(errEnvelope(ErrorCode.FS_GIT_UNAVAILABLE, err.message, requestId)); |
| 616 | return; |
| 617 | } |
| 618 | if (err instanceof SessionNotFoundError) { |
| 619 | reply.send(errEnvelope(ErrorCode.SESSION_NOT_FOUND, err.message, requestId)); |
| 620 | return; |
| 621 | } |
| 622 | throw err; |
| 623 | } |
| 624 | |
| 625 | function buildValidationEnvelope( |
| 626 | issues: readonly { path: readonly PropertyKey[]; message: string }[], |
no test coverage detected