Skip to content

Instantly share code, notes, and snippets.

@k1r0s
Created June 3, 2017 07:19
Show Gist options
  • Save k1r0s/f6f048ab85101894f1b4dd535c885e80 to your computer and use it in GitHub Desktop.
Save k1r0s/f6f048ab85101894f1b4dd535c885e80 to your computer and use it in GitHub Desktop.
Handle exceptions in React components
import * as React from "react";
import Sidebar from "../Sidebar/Sidebar.main";
import Content from "../Content/Content.main";
import { Advices } from "../../advices/Advices"
import { onException, afterMethod } from "kaop-ts"
export default class Root extends React.Component<null, null> {
@onException(Advices.blameCovfefe)
@afterMethod(Advices.throwOnError)
render(){
return (
<div className="mainContainer">
<Sidebar />
<Content />
</div>
)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment