Skip to content

Commit

Permalink
Merge pull request #21 from Wikia/PLATFORM-9121
Browse files Browse the repository at this point in the history
PLATFORM-9121 | Do not swallow DB errors in Cargo query
  • Loading branch information
harnash authored Mar 6, 2024
2 parents 952a358 + 3e29ed7 commit 39eca5c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions includes/CargoLuaLibrary.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ public function cargoQuery( $tables, $fields, $args ): array {
$query = CargoSQLQuery::newFromValues( $tables, $fields, $where, $join,
$groupBy, $having, $orderBy, $limit, $offset );
$rows = $query->run();
} catch ( \Wikimedia\Rdbms\DBError $e ) {
throw $e;
} catch ( Exception $e ) {
// Allow for error handling within Lua.
throw new Scribunto_LuaError( $e->getMessage() );
Expand Down
2 changes: 2 additions & 0 deletions includes/parserfunctions/CargoQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ public static function run( $parser ) {
);
$queryResultsJustForResultsTitle = $sqlQueryJustForResultsTitle->run();
}
} catch ( \Wikimedia\Rdbms\DBError $e ) {
throw $e;
} catch ( Exception $e ) {
return CargoUtils::formatError( $e->getMessage() );
}
Expand Down

0 comments on commit 39eca5c

Please sign in to comment.