# Catch Decorators? How about this??

**URL:** <https://forum.kirupa.com/t/catch-decorators-how-about-this/638658>\
**Category:** web dev\
**Created:** [August 31, 2018, 10:31am UTC](https://forum.kirupa.com/t/catch-decorators-how-about-this/638658 "2018-08-31T10:31:50Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![senocular](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/senocular/32/7217_2.png) [@senocular](https://forum.kirupa.com/u/senocular)\
**Post date:** [August 31, 2018, 10:31am UTC](https://forum.kirupa.com/t/catch-decorators-how-about-this/638658/1 "2018-08-31T10:31:51Z")

</div>

So this guy is all like…

> <https://twitter.com/k1r0s/status/1035134626258411521>

And I’m all like, why not…

[![](https://i.imgur.com/KUAh9vH.jpg) ](https://i.imgur.com/KUAh9vH.jpg)

Right?!?

I guess I was the only one that thought it was funny 😔

---

<div class="post-metadata">

**Author:** ![kirupa](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/kirupa/32/11616_2.png) [@kirupa](https://forum.kirupa.com/u/kirupa)\
**Post date:** [August 31, 2018, 5:03pm UTC](https://forum.kirupa.com/t/catch-decorators-how-about-this/638658/2 "2018-08-31T17:03:00Z")

</div>

I actually have no idea what I’m looking at here. Maybe…just maybe…I should probably know more about decorators haha.

---

<div class="post-metadata">

**Author:** ![senocular](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/senocular/32/7217_2.png) [@senocular](https://forum.kirupa.com/u/senocular)\
**Post date:** [August 31, 2018, 7:22pm UTC](https://forum.kirupa.com/t/catch-decorators-how-about-this/638658/3 "2018-08-31T19:22:04Z")

</div>

😉

The short version is that decorators are functions that get called to wrap definitions and return new definitions. So something like this:

```auto
@MyDecorator
myMethod() {
    // ...
}

```

is basically the same as this

```auto
myMethod = MyDecorator(function myMethod () {
    // ...
})

```

This guy is making a decorator to create try…catch handlers for functions, apparently at the expense of losing all scope and context for riding the decorator train. My joke was, why stop at ripping try…catch out of the function? Why not put the whole function in a decorator? 😛
