forked from Alex/Pterodactyl-Panel
If folder does not exist, reload the file manager index
This commit is contained in:
parent
8ce0863559
commit
6b2d7b6488
@ -7,18 +7,38 @@ use Pterodactyl\Exceptions\DisplayException;
|
|||||||
|
|
||||||
class DaemonConnectionException extends DisplayException
|
class DaemonConnectionException extends DisplayException
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
private $statusCode = 500;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Throw a displayable exception caused by a daemon connection error.
|
* Throw a displayable exception caused by a daemon connection error.
|
||||||
*
|
*
|
||||||
* @param \GuzzleHttp\Exception\GuzzleException $previous
|
* @param \GuzzleHttp\Exception\GuzzleException $previous
|
||||||
|
* @param bool $useStatusCode
|
||||||
*/
|
*/
|
||||||
public function __construct(GuzzleException $previous)
|
public function __construct(GuzzleException $previous, bool $useStatusCode = false)
|
||||||
{
|
{
|
||||||
/** @var \GuzzleHttp\Psr7\Response|null $response */
|
/** @var \GuzzleHttp\Psr7\Response|null $response */
|
||||||
$response = method_exists($previous, 'getResponse') ? $previous->getResponse() : null;
|
$response = method_exists($previous, 'getResponse') ? $previous->getResponse() : null;
|
||||||
|
|
||||||
|
if ($useStatusCode) {
|
||||||
|
$this->statusCode = is_null($response) ? 500 : $response->getStatusCode();
|
||||||
|
}
|
||||||
|
|
||||||
parent::__construct(trans('admin/server.exceptions.daemon_exception', [
|
parent::__construct(trans('admin/server.exceptions.daemon_exception', [
|
||||||
'code' => is_null($response) ? 'E_CONN_REFUSED' : $response->getStatusCode(),
|
'code' => is_null($response) ? 'E_CONN_REFUSED' : $response->getStatusCode(),
|
||||||
]), $previous, DisplayException::LEVEL_WARNING);
|
]), $previous, DisplayException::LEVEL_WARNING);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the HTTP status code for this exception.
|
||||||
|
*
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public function getStatusCode()
|
||||||
|
{
|
||||||
|
return $this->statusCode;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -63,6 +63,11 @@ class FileManager {
|
|||||||
if (_.isFunction(next)) {
|
if (_.isFunction(next)) {
|
||||||
return next(new Error('Failed to load file listing.'));
|
return next(new Error('Failed to load file listing.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((path !== '' && path !== '/') && jqXHR.status === 404) {
|
||||||
|
return this.list('', next);
|
||||||
|
}
|
||||||
|
|
||||||
swal({
|
swal({
|
||||||
type: 'error',
|
type: 'error',
|
||||||
title: 'File Error',
|
title: 'File Error',
|
||||||
|
Loading…
Reference in New Issue
Block a user