---
layout: docs
title: addCatchBlock
id: class.Facebook.HackCodegen.HackBuilder.addCatchBlock
docid: class.Facebook.HackCodegen.HackBuilder.addCatchBlock
permalink: /docs/reference/class.Facebook.HackCodegen.HackBuilder.addCatchBlock/
---
# Facebook\\HackCodegen\\HackBuilder::addCatchBlock()




Start a catch block




``` Hack
public function addCatchBlock(
  string $class,
  string $variable,
): this;
```




## Parameters




- ` string $class `
- ` string $variable `




## Returns




+ ` this `