Skip to content

Instantly share code, notes, and snippets.

@jrsinclair
Created December 5, 2018 06:52
Show Gist options
  • Save jrsinclair/219180f7e3bfe5de6184eb5a70393c0b to your computer and use it in GitHub Desktop.
Save jrsinclair/219180f7e3bfe5de6184eb5a70393c0b to your computer and use it in GitHub Desktop.
Elegant Error Handling Code Samples
function processRow(headerFields, row) {
const rowObjWithDate = right(row)
.map(splitFields)
.chain(zipRow(headerFields))
.chain(addDateStr);
return either(showError, rowToMessage, rowObjWithDate);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment