(payloadPath: string)
| 21 | } |
| 22 | |
| 23 | async function readPushPayloadFile(payloadPath: string): Promise<string> { |
| 24 | try { |
| 25 | return await fs.readFile(payloadPath, 'utf8'); |
| 26 | } catch (error) { |
| 27 | const code = (error as NodeJS.ErrnoException).code; |
| 28 | if (code === 'ENOENT') { |
| 29 | throw new AppError('INVALID_ARGS', `Push payload file not found: ${payloadPath}`); |
| 30 | } |
| 31 | if (code === 'EISDIR') { |
| 32 | throw new AppError('INVALID_ARGS', `Push payload path is not a file: ${payloadPath}`); |
| 33 | } |
| 34 | if (code === 'EACCES' || code === 'EPERM') { |
| 35 | throw new AppError('INVALID_ARGS', `Push payload file is not readable: ${payloadPath}`); |
| 36 | } |
| 37 | throw new AppError('COMMAND_FAILED', `Unable to read push payload file: ${payloadPath}`, { |
| 38 | cause: String(error), |
| 39 | }); |
| 40 | } |
| 41 | } |
no outgoing calls
no test coverage detected
searching dependent graphs…