{"version":3,"file":"errors.mjs","names":["projectErrorCause","cause","reason","Cause","contract"],"sources":["../../../src/modules/effect/errors.ts"],"sourcesContent":["import { Cause } from 'effect'\nimport type { DecodedFailure, ErrorContract, ErrorDefinitions } from '../contracts/errors'\n\n/** Inspect the whole Cause; cleanup defects and other composite reasons cannot become expected data. */\nexport function projectErrorCause<Definitions extends ErrorDefinitions>(\n\tcontract: Pick<ErrorContract<Definitions>, 'project'>,\n\tcause: Cause.Cause<unknown>,\n): DecodedFailure<Definitions> {\n\tif (cause.reasons.length !== 1) return { _tag: 'UnknownFailure', version: 1 }\n\tconst reason = cause.reasons[0]\n\treturn Cause.isFailReason(reason)\n\t\t? contract.project(reason.error)\n\t\t: { _tag: 'UnknownFailure', version: 1 }\n}\n"],"mappings":"+BAIA,SAAgBA,EACf,EACA,EAC8B,CAC9B,GAAIC,EAAM,QAAQ,SAAW,EAAG,MAAO,CAAE,KAAM,iBAAkB,QAAS,CAAE,EAC5E,IAAMC,EAASD,EAAM,QAAQ,GAC7B,OAAOE,EAAM,aAAaD,CAAM,EAC7BE,EAAS,QAAQF,EAAO,KAAK,EAC7B,CAAE,KAAM,iBAAkB,QAAS,CAAE,CACzC"}