{"record":{"id":"0b3d2bceb130f0b4","repo":"sickn33/agentic-awesome-skills","slug":"invalid-age-0b3d2b","errorCode":null,"errorMessage":"Invalid age","messagePattern":"Invalid age","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"skills/fp-ts-pragmatic/SKILL.md","lineNumber":107,"sourceCode":"```\n\n**Plain language translation:**\n- `O.fromNullable(x)` = \"wrap this value, treating null/undefined as 'nothing'\"\n- `O.flatMap(fn)` = \"if we have something, apply this function\"\n- `O.getOrElse(() => default)` = \"unwrap, or use this default if nothing\"\n\n### 3. Either: Make Errors Explicit\n\nStop throwing exceptions for expected failures. Return errors as values.\n\n```typescript\nimport * as E from 'fp-ts/Either'\nimport { pipe } from 'fp-ts/function'\n\n// Before: Hidden failure mode\nfunction parseAge(input: string): number {\n  const age = parseInt(input, 10)\n  if (isNaN(age)) throw new Error('Invalid age')\n  if (age < 0) throw new Error('Age cannot be negative')\n  return age\n}\n\n// After: Errors are visible in the type\nfunction parseAge(input: string): E.Either<string, number> {\n  const age = parseInt(input, 10)\n  if (isNaN(age)) return E.left('Invalid age')\n  if (age < 0) return E.left('Age cannot be negative')\n  return E.right(age)\n}\n\n// Using it\nconst result = parseAge(userInput)\nif (E.isRight(result)) {\n  console.log(`Age is ${result.right}`)\n} else {\n  console.log(`Error: ${result.left}`)","sourceCodeStart":89,"sourceCodeEnd":125,"githubUrl":"https://github.com/sickn33/agentic-awesome-skills/blob/58d857988fcfac6986206bca2b2fe223aa437e4b/skills/fp-ts-pragmatic/SKILL.md#L89-L125","documentation":"Error \"Invalid age\" thrown in sickn33/agentic-awesome-skills.","triggerScenarios":"Thrown at skills/fp-ts-pragmatic/SKILL.md:107 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"58d857988fcfac6986206bca2b2fe223aa437e4b","analyzedAt":"2026-08-26T11:55:59.350Z","schemaVersion":2},"datasetVersion":"2026-08-26T14:46:13.012Z"}