PR for dev_1.0

Put this inside a try catch block
```php
try {
    $db = DB::conn();
    $db->begin();

    $params = array('title' => $this->title);
    $db->insert('thread', $params);

    $this->id = $db->lastInsertId();
    $this->write($comment);

    $db->commit();
} catch (Exception $e) {
    $db->rollback();
}
```