refactor(http-recorder): use Schema.TaggedErrorClass for cassette errors (#26729)
This commit is contained in:
parent
b616543ac2
commit
e45b6ef1de
3 changed files with 18 additions and 14 deletions
|
|
@ -1,13 +1,13 @@
|
|||
import { Data, Effect, Ref, Scope } from "effect"
|
||||
import { Effect, Ref, Schema, Scope } from "effect"
|
||||
import type * as CassetteService from "./cassette"
|
||||
import type { CassetteNotFoundError } from "./cassette"
|
||||
import type { SecretFinding } from "./redaction"
|
||||
import { SecretFindingSchema } from "./redaction"
|
||||
import type { CassetteMetadata, Interaction } from "./schema"
|
||||
|
||||
export class UnsafeCassetteError extends Data.TaggedError("UnsafeCassetteError")<{
|
||||
readonly cassetteName: string
|
||||
readonly findings: ReadonlyArray<SecretFinding>
|
||||
}> {
|
||||
export class UnsafeCassetteError extends Schema.TaggedErrorClass<UnsafeCassetteError>()("UnsafeCassetteError", {
|
||||
cassetteName: Schema.String,
|
||||
findings: Schema.Array(SecretFindingSchema),
|
||||
}) {
|
||||
override get message() {
|
||||
return `Refusing to write cassette "${this.cassetteName}" because it contains possible secrets: ${this.findings
|
||||
.map((finding) => `${finding.path} (${finding.reason})`)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue