33
0
mirror of https://github.com/joomla-extensions/patchtester.git synced 2025-04-11 08:11:53 +00:00

Chain exceptions

This commit is contained in:
Michael Babker 2015-06-16 15:14:41 -04:00
parent 9b8a4d6745
commit cafe878eea
3 changed files with 9 additions and 7 deletions

View File

@ -53,7 +53,9 @@ class StartfetchController extends DisplayController
{ {
$response = new \JResponseJson( $response = new \JResponseJson(
new \Exception( new \Exception(
\JText::sprintf('COM_PATCHTESTER_COULD_NOT_CONNECT_TO_GITHUB', $e->getMessage()) \JText::sprintf('COM_PATCHTESTER_COULD_NOT_CONNECT_TO_GITHUB', $e->getMessage()),
$e->getCode(),
$e
) )
); );

View File

@ -139,7 +139,7 @@ class PullModel extends \JModelBase
} }
catch (\Exception $e) catch (\Exception $e)
{ {
throw new \RuntimeException(\JText::sprintf('COM_PATCHTESTER_COULD_NOT_CONNECT_TO_GITHUB', $e->getMessage())); throw new \RuntimeException(\JText::sprintf('COM_PATCHTESTER_COULD_NOT_CONNECT_TO_GITHUB', $e->getMessage()), $e->getCode(), $e);
} }
// If over the API limit, we can't build this list // If over the API limit, we can't build this list
@ -156,7 +156,7 @@ class PullModel extends \JModelBase
} }
catch (\Exception $e) catch (\Exception $e)
{ {
throw new \RuntimeException(\JText::sprintf('COM_PATCHTESTER_COULD_NOT_CONNECT_TO_GITHUB', $e->getMessage())); throw new \RuntimeException(\JText::sprintf('COM_PATCHTESTER_COULD_NOT_CONNECT_TO_GITHUB', $e->getMessage()), $e->getCode(), $e);
} }
if (is_null($pull->head->repo)) if (is_null($pull->head->repo))
@ -177,7 +177,7 @@ class PullModel extends \JModelBase
} }
catch (\Exception $e) catch (\Exception $e)
{ {
throw new \RuntimeException(\JText::sprintf('COM_PATCHTESTER_COULD_NOT_CONNECT_TO_GITHUB', $e->getMessage())); throw new \RuntimeException(\JText::sprintf('COM_PATCHTESTER_COULD_NOT_CONNECT_TO_GITHUB', $e->getMessage()), $e->getCode(), $e);
} }
$files = $this->parsePatch($patch); $files = $this->parsePatch($patch);
@ -216,7 +216,7 @@ class PullModel extends \JModelBase
} }
catch (\Exception $e) catch (\Exception $e)
{ {
throw new \RuntimeException(\JText::sprintf('COM_PATCHTESTER_COULD_NOT_CONNECT_TO_GITHUB', $e->getMessage())); throw new \RuntimeException(\JText::sprintf('COM_PATCHTESTER_COULD_NOT_CONNECT_TO_GITHUB', $e->getMessage()), $e->getCode(), $e);
} }
} }
} }

View File

@ -327,7 +327,7 @@ class PullsModel extends \JModelDatabase
} }
catch (\DomainException $e) catch (\DomainException $e)
{ {
throw new \RuntimeException(\JText::sprintf('COM_PATCHTESTER_ERROR_GITHUB_FETCH', $e->getMessage())); throw new \RuntimeException(\JText::sprintf('COM_PATCHTESTER_ERROR_GITHUB_FETCH', $e->getMessage()), $e->getCode(), $e);
} }
$count = is_array($pulls) ? count($pulls) : 0; $count = is_array($pulls) ? count($pulls) : 0;
@ -373,7 +373,7 @@ class PullsModel extends \JModelDatabase
} }
catch (\RuntimeException $e) catch (\RuntimeException $e)
{ {
throw new \RuntimeException(\JText::sprintf('COM_PATCHTESTER_ERROR_INSERT_DATABASE', $e->getMessage())); throw new \RuntimeException(\JText::sprintf('COM_PATCHTESTER_ERROR_INSERT_DATABASE', $e->getMessage()), $e->getCode(), $e);
} }
// Need to make another request // Need to make another request