Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save trycf/113312755c4a7d0ac0b122cae158f6ef to your computer and use it in GitHub Desktop.

Select an option

Save trycf/113312755c4a7d0ac0b122cae158f6ef to your computer and use it in GitHub Desktop.
TryCF Gist
<cfscript>
function foo(forceError = false) {
try {
if (forceError) {
throw('Oopsie! An Error')
}
return [{a: 'test'}, {}]
} catch(any e) {
return [{}, e]
}
}
[data, error] = foo(true)
if (!structIsEmpty(error)) {
writeDump('oh no! an error in success!')
}
writeDump({ data, error })
</cfscript>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment