Rethrow (as PiiRedactionError) or scrub-to-marker, per `onFailure`.
( error: unknown, options: RedactLargeValueRefsOptions, context: string )
| 148 | |
| 149 | /** Rethrow (as {@link PiiRedactionError}) or scrub-to-marker, per `onFailure`. */ |
| 150 | function onRefFailure( |
| 151 | error: unknown, |
| 152 | options: RedactLargeValueRefsOptions, |
| 153 | context: string |
| 154 | ): never | string { |
| 155 | if ((options.onFailure ?? 'scrub') === 'throw') { |
| 156 | throw error instanceof PiiRedactionError |
| 157 | ? error |
| 158 | : new PiiRedactionError(`${context}: ${getErrorMessage(error)}`) |
| 159 | } |
| 160 | logger.error(`${context}; scrubbing`, { error: getErrorMessage(error) }) |
| 161 | return REDACTION_FAILED_MARKER |
| 162 | } |
| 163 | |
| 164 | async function redactRef( |
| 165 | ref: LargeValueRef, |
no test coverage detected