Skip to content

Commit

Permalink
Update classes/kohana/database/mssql.php
Browse files Browse the repository at this point in the history
Добавляем вывод ошибки в читабельном виде, а не в виде кода
  • Loading branch information
gorets committed Sep 14, 2012
1 parent 345f50b commit c2246c2
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions classes/kohana/database/mssql.php
Expand Up @@ -76,11 +76,15 @@ public function query($type, $sql, $as_object = FALSE, array $params = NULL)
Profiler::delete($benchmark);
}

$errArr = $this->_connection->errorInfo();
$resultTextError = $this->_connection->query( "select * from sys.messages where language_id=1033 and message_id=".arr::get($errArr, 1, 0) )->fetchAll();

// Convert the exception in a database exception
throw new Database_Exception('[:code] :error ( :query )', array(
':code' => $e->getMessage(),
':error' => $e->getCode(),
':query' => $sql,
throw new Database_Exception('[:code] :error ( :info )', array(
':code' => $e->getCode(),
':error' => $e->getMessage(),
#':query' => $sql,
':info' => arr::get($resultTextError[0], 'text')
), $e->getCode());
}

Expand Down

0 comments on commit c2246c2

Please sign in to comment.