Skip to content

Commit

Permalink
add internal server error
Browse files Browse the repository at this point in the history
  • Loading branch information
kylekz committed Feb 18, 2018
1 parent 51c50dc commit 111a3ef
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/Exceptions/InternalServerException.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

namespace Reflex\Paladins\Exceptions;

use Reflex\Paladins\ApiException;

class InternalServerException extends ApiException {

}
3 changes: 3 additions & 0 deletions src/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use Reflex\Paladins\Exceptions\AccessValidationException;
use Reflex\Paladins\Exceptions\NotFoundException;
use Reflex\Paladins\Exceptions\RateLimitException;
use Reflex\Paladins\Exceptions\InternalServerException;

/**
* Class to manage individual requests to the Paladins API
Expand Down Expand Up @@ -268,6 +269,8 @@ public function send() {
throw new AccessValidationException($message, $e->getCode(), $e);
} elseif (strpos($message, '404 Not Found') !== false) {
throw new NotFoundException($message, $e->getCode(), $e);
} elseif (strpos($message, '500 Internal Server Error') !== false) {
throw new InternalServerException($message, $e->getCode(), $e);
} else {
throw new ApiException($message, $e->getCode(), $e);
}
Expand Down

0 comments on commit 111a3ef

Please sign in to comment.