mirror of
https://github.com/MrUnknownDE/panel.git
synced 2026-04-20 15:23:44 +02:00
Clean up exception handling code, closes #81
Makes sure things get logged properly.
This commit is contained in:
@@ -30,6 +30,8 @@ use DB;
|
||||
|
||||
use Pterodactyl\Models;
|
||||
use Pterodactyl\Repositories\NodeRepository;
|
||||
use Pterodactyl\Exceptions\DisplayException;
|
||||
use Pterodactyl\Exceptions\DisplayValidationException;
|
||||
|
||||
use Pterodactyl\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
@@ -79,9 +81,9 @@ class NodesController extends Controller
|
||||
return redirect()->route('admin.nodes.view', [
|
||||
'id' => $new
|
||||
]);
|
||||
} catch (\Pterodactyl\Exceptions\DisplayValidationException $e) {
|
||||
} catch (DisplayValidationException $e) {
|
||||
return redirect()->route('admin.nodes.new')->withErrors(json_decode($e->getMessage()))->withInput();
|
||||
} catch (\Pterodactyl\Exceptions\DisplayException $e) {
|
||||
} catch (DisplayException $e) {
|
||||
Alert::danger($e->getMessage())->flash();
|
||||
} catch (\Exception $e) {
|
||||
Log::error($e);
|
||||
@@ -134,9 +136,9 @@ class NodesController extends Controller
|
||||
'id' => $id,
|
||||
'tab' => 'tab_settings'
|
||||
]);
|
||||
} catch (\Pterodactyl\Exceptions\DisplayValidationException $e) {
|
||||
} catch (DisplayValidationException $e) {
|
||||
return redirect()->route('admin.nodes.view', $id)->withErrors(json_decode($e->getMessage()))->withInput();
|
||||
} catch (\Pterodactyl\Exceptions\DisplayException $e) {
|
||||
} catch (DisplayException $e) {
|
||||
Alert::danger($e->getMessage())->flash();
|
||||
} catch (\Exception $e) {
|
||||
Log::error($e);
|
||||
@@ -194,12 +196,12 @@ class NodesController extends Controller
|
||||
|
||||
try {
|
||||
if(empty($processedData)) {
|
||||
throw new \Pterodactyl\Exceptions\DisplayException('It seems that no data was passed to this function.');
|
||||
throw new DisplayException('It seems that no data was passed to this function.');
|
||||
}
|
||||
$node = new NodeRepository;
|
||||
$node->addAllocations($id, $processedData);
|
||||
Alert::success('Successfully added new allocations to this node.')->flash();
|
||||
} catch (\Pterodactyl\Exceptions\DisplayException $e) {
|
||||
} catch (DisplayException $e) {
|
||||
Alert::danger($e->getMessage())->flash();
|
||||
} catch (\Exception $e) {
|
||||
Log::error($e);
|
||||
|
||||
Reference in New Issue
Block a user