Skip to content

Commit

Permalink
add AsyncMysqlQueryErrorResult and SQLFakeAsyncMysqlException (#110)
Browse files Browse the repository at this point in the history
  • Loading branch information
pbibra authored Oct 6, 2023
1 parent ef87737 commit da4bd2f
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/AsyncMysql/AsyncMysqlQueryErrorResult.hack
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
namespace Slack\SQLFake;

<<__MockClass>>
final class AsyncMysqlQueryErrorResult extends \AsyncMysqlQueryErrorResult {

/* HH_IGNORE_ERROR[3012] I don't want to call parent::construct */
public function __construct(private int $mysql_errno = 1105, private string $mysql_error = 'ERUnknownError') {}

<<__Override>>
// HHAST_IGNORE_ERROR[CamelCasedMethodsUnderscoredFunctions]
public function mysql_errno(): int {
return $this->mysql_errno;
}

<<__Override>>
// HHAST_IGNORE_ERROR[CamelCasedMethodsUnderscoredFunctions]
public function mysql_error(): string {
return $this->mysql_error;
}
}
8 changes: 8 additions & 0 deletions src/Exception.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,11 @@ final class SQLFakeParseException extends SQLFakeException {}
final class SQLFakeRuntimeException extends SQLFakeException {}
final class SQLFakeUniqueKeyViolation extends SQLFakeException {}
final class SQLFakeVitessQueryViolation extends SQLFakeException {}
final class SQLFakeAsyncMysqlException extends SQLFakeException {
public function __construct(private \AsyncMysqlErrorResult $result) {
parent::__construct();
}
public function getResult(): \AsyncMysqlErrorResult {
return $this->result;
}
}

0 comments on commit da4bd2f

Please sign in to comment.