(err: unknown)
| 349 | } |
| 350 | |
| 351 | function writeFailure(err: unknown): ApiError { |
| 352 | const code = (err as NodeJS.ErrnoException).code; |
| 353 | const detail = err instanceof Error ? err.message : String(err); |
| 354 | if (code === 'EACCES' || code === 'EPERM' || code === 'EROFS') { |
| 355 | return new ApiError( |
| 356 | 'refused', |
| 357 | `Saved trails could not be written: ${detail}`, |
| 358 | `The viewer writes only to ${TRAILS_RELATIVE_DIR} inside this project. Check that it is writable.` |
| 359 | ); |
| 360 | } |
| 361 | return new ApiError('internal', `Saved trails could not be written: ${detail}`); |
| 362 | } |
no outgoing calls
no test coverage detected