Clean up exception handling code, closes #81
Makes sure things get logged properly.
This commit is contained in:
parent
e0bff4db8e
commit
228d6b1b21
6 changed files with 96 additions and 136 deletions
|
@ -25,7 +25,6 @@ namespace Pterodactyl\Http\Controllers\Server;
|
|||
|
||||
use Auth;
|
||||
use DB;
|
||||
use Debugbar;
|
||||
use Uuid;
|
||||
use Alert;
|
||||
use Log;
|
||||
|
@ -133,18 +132,13 @@ class ServerController extends Controller
|
|||
|
||||
try {
|
||||
$fileContent = $controller->returnFileContents($file);
|
||||
} catch (\Exception $e) {
|
||||
|
||||
Debugbar::addException($e);
|
||||
$exception = 'An error occured while attempting to load the requested file for editing, please try again.';
|
||||
|
||||
if ($e instanceof DisplayException) {
|
||||
$exception = $e->getMessage();
|
||||
}
|
||||
|
||||
Alert::danger($exception)->flash();
|
||||
} catch (DisplayException $ex) {
|
||||
Alert::danger($ex->getMessage())->flash();
|
||||
return redirect()->route('server.files.index', $uuid);
|
||||
} catch (\Exception $ex) {
|
||||
Log::error($ex);
|
||||
Alert::danger('An error occured while attempting to load the requested file for editing, please try again.')->flash();
|
||||
return redirect()->route('server.files.index', $uuid);
|
||||
|
||||
}
|
||||
|
||||
return view('server.files.edit', [
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue