fix: boarding

fix: error handling
fix: restarting state
This commit is contained in:
Andras Bacsai
2023-09-15 15:34:25 +02:00
parent fcf7c5ddd5
commit da4c2ee60f
71 changed files with 326 additions and 290 deletions

View File

@@ -14,7 +14,6 @@ use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Crypt;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Str;
use Throwable;
class Controller extends BaseController
{
@@ -153,7 +152,7 @@ class Controller extends BaseController
} else {
abort(401);
}
} catch (Throwable $e) {
} catch (\Throwable $e) {
ray($e->getMessage());
throw $e;
}
@@ -172,7 +171,7 @@ class Controller extends BaseController
}
$invitation->delete();
return redirect()->route('team.index');
} catch (Throwable $e) {
} catch (\Throwable $e) {
throw $e;
}
}

View File

@@ -9,6 +9,7 @@ use App\Models\Server;
use App\Models\Team;
use Illuminate\Support\Collection;
use Livewire\Component;
use Visus\Cuid2\Cuid2;
class Index extends Component
{
@@ -53,7 +54,8 @@ uZx9iFkCELtxrh31QJ68AAAAEXNhaWxANzZmZjY2ZDJlMmRkAQIDBA==
$this->remoteServerHost = 'coolify-testing-host';
}
}
public function explanation() {
public function explanation()
{
if (isCloud()) {
return $this->setServerType('remote');
}
@@ -115,7 +117,8 @@ uZx9iFkCELtxrh31QJ68AAAAEXNhaWxANzZmZjY2ZDJlMmRkAQIDBA==
$this->getProxyType();
$this->getProjects();
}
public function getProxyType() {
public function getProxyType()
{
$proxyTypeSet = $this->createdServer->proxy->type;
if (!$proxyTypeSet) {
$this->currentState = 'select-proxy';
@@ -153,49 +156,68 @@ uZx9iFkCELtxrh31QJ68AAAAEXNhaWxANzZmZjY2ZDJlMmRkAQIDBA==
{
$this->validate([
'remoteServerName' => 'required',
'remoteServerHost' => 'required',
'remoteServerPort' => 'required',
'remoteServerHost' => 'required|ip',
'remoteServerPort' => 'required|integer',
'remoteServerUser' => 'required',
]);
$this->privateKey = formatPrivateKey($this->privateKey);
$this->createdPrivateKey = PrivateKey::create([
'name' => $this->privateKeyName,
'description' => $this->privateKeyDescription,
'private_key' => $this->privateKey,
'team_id' => currentTeam()->id
]);
$this->createdServer = Server::create([
'name' => $this->remoteServerName,
'ip' => $this->remoteServerHost,
'port' => $this->remoteServerPort,
'user' => $this->remoteServerUser,
'description' => $this->remoteServerDescription,
'private_key_id' => $this->createdPrivateKey->id,
'team_id' => currentTeam()->id
]);
$this->createdPrivateKey = new PrivateKey();
$this->createdPrivateKey->private_key = $this->privateKey;
$this->createdPrivateKey->name = $this->privateKeyName;
$this->createdPrivateKey->description = $this->privateKeyDescription;
$this->createdPrivateKey->team_id = currentTeam()->id;
$foundServer = Server::whereIp($this->remoteServerHost)->first();
if ($foundServer) {
return $this->emit('error', 'IP address is already in use by another team.');
}
$this->createdServer = new Server();
$this->createdServer->uuid = (string)new Cuid2(7);
$this->createdServer->name = $this->remoteServerName;
$this->createdServer->ip = $this->remoteServerHost;
$this->createdServer->port = $this->remoteServerPort;
$this->createdServer->user = $this->remoteServerUser;
$this->createdServer->description = $this->remoteServerDescription;
$this->createdServer->privateKey = $this->createdPrivateKey;
$this->createdServer->team_id = currentTeam()->id;
ray($this->createdServer);
$this->validateServer();
}
public function validateServer() {
public function validateServer()
{
try {
['uptime' => $uptime, 'dockerVersion' => $dockerVersion] = validateServer($this->createdServer);
if (!$uptime) {
throw new \Exception('Server is not reachable.');
} else {
$this->createdServer->settings->update([
'is_reachable' => true,
]);
$this->emit('success', 'Server is reachable.');
}
ray($dockerVersion, $uptime);
if (!$dockerVersion) {
$this->emit('error', 'Docker is not installed on the server.');
$this->currentState = 'install-docker';
return;
$customErrorMessage = "Server is not reachable:";
config()->set('coolify.mux_enabled', false);
instant_remote_process(['uptime'], $this->createdServer, true);
$dockerVersion = instant_remote_process(["docker version|head -2|grep -i version| awk '{print $2}'"], $this->createdServer, true);
$dockerVersion = checkMinimumDockerEngineVersion($dockerVersion);
if (is_null($dockerVersion)) {
throw new \Exception('No Docker Engine or older than 23 version installed.');
}
$customErrorMessage = "Cannot create Server or Private Key. Please try again.";
$createdPrivateKey = PrivateKey::create([
'name' => $this->privateKeyName,
'description' => $this->privateKeyDescription,
'private_key' => $this->privateKey,
'team_id' => currentTeam()->id
]);
$server = Server::create([
'name' => $this->remoteServerName,
'ip' => $this->remoteServerHost,
'port' => $this->remoteServerPort,
'user' => $this->remoteServerUser,
'description' => $this->remoteServerDescription,
'private_key_id' => $createdPrivateKey->id,
'team_id' => currentTeam()->id,
]);
$server->settings->is_reachable = true;
$server->settings->is_usable = true;
$server->settings->save();
$this->getProxyType();
} catch (\Throwable $e) {
return general_error_handler(customErrorMessage: "Server is not reachable. Reason: {$e->getMessage()}", that: $this);
return handleError(error: $e, customErrorMessage: $customErrorMessage, livewire: $this);
}
}
public function installDocker()
@@ -215,14 +237,16 @@ uZx9iFkCELtxrh31QJ68AAAAEXNhaWxANzZmZjY2ZDJlMmRkAQIDBA==
$this->getProjects();
}
public function getProjects() {
public function getProjects()
{
$this->projects = Project::ownedByCurrentTeam(['name'])->get();
if ($this->projects->count() > 0) {
$this->selectedExistingProject = $this->projects->first()->id;
}
$this->currentState = 'create-project';
}
public function selectExistingProject() {
public function selectExistingProject()
{
$this->createdProject = Project::find($this->selectedExistingProject);
$this->currentState = 'create-resource';
}
@@ -242,7 +266,7 @@ uZx9iFkCELtxrh31QJ68AAAAEXNhaWxANzZmZjY2ZDJlMmRkAQIDBA==
[
'project_uuid' => $this->createdProject->uuid,
'environment_name' => 'production',
'server'=> $this->createdServer->id,
'server' => $this->createdServer->id,
]
);
}

View File

@@ -38,7 +38,7 @@ class Form extends Component
$this->destination->delete();
return redirect()->route('dashboard');
} catch (\Throwable $e) {
return general_error_handler(err: $e);
return handleError($e);
}
}
}

View File

@@ -72,7 +72,7 @@ class StandaloneDocker extends Component
$this->createNetworkAndAttachToProxy();
return redirect()->route('destination.show', $docker->uuid);
} catch (\Throwable $e) {
return general_error_handler(err: $e, that: $this);
return handleError($e, $this);
}
}

View File

@@ -37,7 +37,7 @@ class ForcePasswordReset extends Component
}
return redirect()->route('dashboard');
} catch (\Throwable $e) {
return general_error_handler(err: $e, that: $this);
return handleError($e, $this);
}
}
}

View File

@@ -44,7 +44,7 @@ class Help extends Component
send_user_an_email($mail, auth()->user()?->email, 'hi@coollabs.io');
$this->emit('success', 'Your message has been sent successfully. We will get in touch with you as soon as possible.');
} catch (\Throwable $e) {
return general_error_handler($e, $this);
return handleError($e, $this);
}
}
public function render()

View File

@@ -64,7 +64,7 @@ class EmailSettings extends Component
$this->team->save();
$this->emit('success', 'Settings saved successfully.');
} catch (\Throwable $e) {
return general_error_handler($e, $this);
return handleError($e, $this);
}
}
public function sendTestNotification()
@@ -83,7 +83,7 @@ class EmailSettings extends Component
$this->team->save();
$this->emit('success', 'Settings saved successfully.');
} catch (\Throwable $e) {
return general_error_handler($e, $this);
return handleError($e, $this);
}
}
@@ -94,7 +94,7 @@ class EmailSettings extends Component
$this->submitResend();
} catch (\Throwable $e) {
$this->team->smtp_enabled = false;
return general_error_handler($e, $this);
return handleError($e, $this);
}
}
public function instantSave()
@@ -104,7 +104,7 @@ class EmailSettings extends Component
$this->submit();
} catch (\Throwable $e) {
$this->team->smtp_enabled = false;
return general_error_handler($e, $this);
return handleError($e, $this);
}
}
public function saveModel()
@@ -130,7 +130,7 @@ class EmailSettings extends Component
$this->emit('success', 'Settings saved successfully.');
} catch (\Throwable $e) {
$this->team->smtp_enabled = false;
return general_error_handler($e, $this);
return handleError($e, $this);
}
}
public function submitResend()
@@ -146,7 +146,7 @@ class EmailSettings extends Component
$this->emit('success', 'Settings saved successfully.');
} catch (\Throwable $e) {
$this->team->resend_enabled = false;
return general_error_handler($e, $this);
return handleError($e, $this);
}
}
public function copyFromInstanceSettings()

View File

@@ -25,8 +25,8 @@ class Change extends Component
{
try {
$this->public_key = $this->private_key->publicKey();
}catch(\Exception $e) {
return general_error_handler(err: $e, that: $this);
}catch(\Throwable $e) {
return handleError($e, $this);
}
}
public function delete()
@@ -39,7 +39,7 @@ class Change extends Component
}
$this->emit('error', 'This private key is in use and cannot be deleted. Please delete all servers, applications, and GitHub/GitLab apps that use this private key before deleting it.');
} catch (\Throwable $e) {
return general_error_handler(err: $e, that: $this);
return handleError($e, $this);
}
}
@@ -50,7 +50,7 @@ class Change extends Component
$this->private_key->save();
refresh_server_connection($this->private_key);
} catch (\Throwable $e) {
return general_error_handler(err: $e, that: $this);
return handleError($e, $this);
}
}
}

View File

@@ -58,7 +58,7 @@ class Create extends Component
}
return redirect()->route('security.private-key.show', ['private_key_uuid' => $private_key->uuid]);
} catch (\Throwable $e) {
return general_error_handler(err: $e, that: $this);
return handleError($e, $this);
}
}
}

View File

@@ -34,7 +34,7 @@ class Form extends Component
'name' => $this->name,
]);
} catch (\Throwable $e) {
return general_error_handler(err: $e, that: $this);
return handleError($e, $this);
}
}
}

View File

@@ -29,7 +29,7 @@ class AddEmpty extends Component
]);
return redirect()->route('project.show', $project->uuid);
} catch (\Throwable $e) {
general_error_handler($e, $this);
return handleError($e, $this);
} finally {
$this->name = '';
}

View File

@@ -32,7 +32,7 @@ class AddEnvironment extends Component
'environment_name' => $environment->name,
]);
} catch (\Throwable $e) {
general_error_handler($e, $this);
handleError($e, $this);
} finally {
$this->name = '';
}

View File

@@ -65,7 +65,7 @@ class DeploymentNavbar extends Component
]);
}
} catch (\Throwable $e) {
return general_error_handler(err: $e, that: $this);
return handleError($e, $this);
}
}
}

View File

@@ -160,7 +160,7 @@ class General extends Component
$this->application->save();
$this->emit('success', 'Application settings updated!');
} catch (\Throwable $e) {
return general_error_handler(err: $e, that: $this);
return handleError($e, $this);
}
}
}

View File

@@ -30,7 +30,7 @@ class Previews extends Component
$this->pull_requests = $data->sortBy('number')->values();
} catch (\Throwable $e) {
$this->rate_limit_remaining = 0;
return general_error_handler(err: $e, that: $this);
return handleError($e, $this);
}
}
@@ -59,7 +59,7 @@ class Previews extends Component
'environment_name' => $this->parameters['environment_name'],
]);
} catch (\Throwable $e) {
return general_error_handler(err: $e, that: $this);
return handleError($e, $this);
}
}
@@ -79,7 +79,7 @@ class Previews extends Component
ApplicationPreview::where('application_id', $this->application->id)->where('pull_request_id', $pull_request_id)->delete();
$this->application->refresh();
} catch (\Throwable $e) {
return general_error_handler(err: $e, that: $this);
return handleError($e, $this);
}
}

View File

@@ -65,7 +65,7 @@ class Rollback extends Component
];
})->toArray();
} catch (\Throwable $e) {
return general_error_handler(err: $e, that: $this);
return handleError($e, $this);
}
}
}

View File

@@ -43,7 +43,7 @@ class CreateScheduledBackup extends Component
]);
$this->emit('refreshScheduledBackups');
} catch (\Throwable $e) {
general_error_handler($e, $this);
handleError($e, $this);
} finally {
$this->frequency = '';
$this->save_s3 = true;

View File

@@ -35,7 +35,7 @@ class Heading extends Component
public function stop()
{
remote_process(
instant_remote_process(
["docker rm -f {$this->database->uuid}"],
$this->database->destination->server
);
@@ -45,7 +45,7 @@ class Heading extends Component
}
$this->database->status = 'stopped';
$this->database->save();
$this->emit('refresh');
$this->check_status();
// $this->database->environment->project->team->notify(new StatusChanged($this->database));
}

View File

@@ -36,7 +36,7 @@ class InitScript extends Component
$this->script['filename'] = $this->filename;
$this->emitUp('save_init_script', $this->script);
} catch (Exception $e) {
return general_error_handler(err: $e, that: $this);
return handleError($e, $this);
}
}

View File

@@ -5,6 +5,7 @@ namespace App\Http\Livewire\Project\Database\Postgresql;
use App\Models\StandalonePostgresql;
use Exception;
use Livewire\Component;
use function Aws\filter;
class General extends Component
@@ -73,9 +74,9 @@ class General extends Component
}
$this->getDbUrl();
$this->database->save();
} catch(Exception $e) {
} catch(\Throwable $e) {
$this->database->is_public = !$this->database->is_public;
return general_error_handler(err: $e, that: $this);
return handleError($e, $this);
}
}
@@ -140,7 +141,7 @@ class General extends Component
$this->database->save();
$this->emit('success', 'Database updated successfully.');
} catch (Exception $e) {
return general_error_handler(err: $e, that: $this);
return handleError($e, $this);
}
}
}

View File

@@ -20,7 +20,7 @@ class Edit extends Component
$this->project->save();
$this->emit('saved');
} catch (\Throwable $e) {
return general_error_handler($e, $this);
return handleError($e, $this);
}
}
}

View File

@@ -165,7 +165,7 @@ class GithubPrivateRepository extends Component
'project_uuid' => $project->uuid,
]);
} catch (\Throwable $e) {
return general_error_handler(err: $e, that: $this);
return handleError($e, $this);
}
}

View File

@@ -118,7 +118,7 @@ class GithubPrivateRepositoryDeployKey extends Component
'application_uuid' => $application->uuid,
]);
} catch (\Throwable $e) {
return general_error_handler(err: $e, that: $this);
return handleError($e, $this);
}
}

View File

@@ -76,14 +76,14 @@ class PublicGitRepository extends Component
$this->get_branch();
$this->selected_branch = $this->git_branch;
} catch (\Throwable $e) {
return general_error_handler(err: $e, that: $this);
return handleError($e, $this);
}
if (!$this->branch_found && $this->git_branch == 'main') {
try {
$this->git_branch = 'master';
$this->get_branch();
} catch (\Throwable $e) {
return general_error_handler(err: $e, that: $this);
return handleError($e, $this);
}
}
}
@@ -162,7 +162,7 @@ class PublicGitRepository extends Component
'application_uuid' => $application->uuid,
]);
} catch (\Throwable $e) {
return general_error_handler(err: $e, that: $this);
return handleError($e, $this);
}
}
}

View File

@@ -41,7 +41,7 @@ class Select extends Component
// instantCommand("psql {$this->existingPostgresqlUrl} -c 'SELECT 1'");
// $this->emit('success', 'Successfully connected to the database.');
// } catch (\Throwable $e) {
// return general_error_handler($e, $this);
// return handleError($e, $this);
// }
// }
public function setType(string $type)

View File

@@ -114,7 +114,7 @@ class All extends Component
$this->refreshEnvs();
$this->emit('success', 'Environment variable added successfully.');
} catch (\Throwable $e) {
return general_error_handler(err: $e, that: $this);
return handleError($e, $this);
}
}
}

View File

@@ -54,7 +54,7 @@ class ResourceLimits extends Component
$this->resource->save();
$this->emit('success', 'Resource limits updated successfully.');
} catch (\Throwable $e) {
return general_error_handler(err: $e, that: $this);
return handleError($e, $this);
}
}
}

View File

@@ -29,7 +29,7 @@ class All extends Component
$this->emit('success', 'Storage added successfully');
$this->emit('clearAddStorage');
} catch (\Throwable $e) {
return general_error_handler(err: $e, that: $this);
return handleError($e, $this);
}
}
}

View File

@@ -33,7 +33,7 @@ class RunCommand extends Component
$activity = remote_process([$this->command], Server::where('uuid', $this->server)->first(), ignore_errors: true);
$this->emit('newMonitorActivity', $activity->id);
} catch (\Throwable $e) {
return general_error_handler(err: $e);
return handleError($e, $this);
}
}
}

View File

@@ -51,12 +51,12 @@ class Form extends Component
public function validateServer()
{
try {
['uptime' => $uptime, 'dockerVersion' => $dockerVersion] = validateServer($this->server);
['uptime' => $uptime, 'dockerVersion' => $dockerVersion] = validateServer($this->server, true);
if ($uptime) {
$this->uptime = $uptime;
$this->emit('success', 'Server is reachable!');
$this->emit('success', 'Server is reachable.');
} else {
$this->emit('error', 'Server is not reachable');
$this->emit('error', 'Server is not reachable.');
return;
}
if ($dockerVersion) {
@@ -64,10 +64,10 @@ class Form extends Component
$this->emit('proxyStatusUpdated');
$this->emit('success', 'Docker Engine 23+ is installed!');
} else {
$this->emit('error', 'Old (lower than 23) or no Docker version detected. Install Docker Engine on the General tab.');
$this->emit('error', 'No Docker Engine or older than 23 version installed.');
}
} catch (\Throwable $e) {
return general_error_handler($e, that: $this);
return handleError($e, $this, customErrorMessage: "Server is not reachable: ");
}
}
@@ -82,7 +82,7 @@ class Form extends Component
$this->server->delete();
return redirect()->route('server.all');
} catch (\Throwable $e) {
return general_error_handler(err: $e, that: $this);
return handleError($e, $this);
}
}
public function submit()

View File

@@ -79,7 +79,7 @@ class ByIp extends Component
$server->settings->save();
return redirect()->route('server.show', $server->uuid);
} catch (\Throwable $e) {
return general_error_handler(err: $e);
return handleError($e);
}
}
}

View File

@@ -56,7 +56,7 @@ class Proxy extends Component
setup_default_redirect_404(redirect_url: $this->server->proxy->redirect_url, server: $this->server);
$this->emit('success', 'Proxy configuration saved.');
} catch (\Throwable $e) {
return general_error_handler(err: $e);
return handleError($e);
}
}
@@ -65,7 +65,7 @@ class Proxy extends Component
try {
$this->proxy_settings = resolve(CheckConfigurationSync::class)($this->server, true);
} catch (\Throwable $e) {
return general_error_handler(err: $e);
return handleError($e);
}
}
@@ -75,7 +75,7 @@ class Proxy extends Component
ray('loadProxyConfiguration');
$this->proxy_settings = resolve(CheckConfigurationSync::class)($this->server);
} catch (\Throwable $e) {
return general_error_handler(err: $e);
return handleError($e);
}
}
}

View File

@@ -24,7 +24,7 @@ class Status extends Component
$this->emit('proxyStatusUpdated');
}
} catch (\Throwable $e) {
return general_error_handler(err: $e);
return handleError($e);
}
}
public function getProxyStatusWithNoti()

View File

@@ -18,7 +18,7 @@ class Show extends Component
return redirect()->route('server.all');
}
} catch (\Throwable $e) {
return general_error_handler(err: $e, that: $this);
return handleError($e, $this);
}
}
public function render()

View File

@@ -28,14 +28,14 @@ class ShowPrivateKey extends Component
]);
$this->server->refresh();
refresh_server_connection($this->server->privateKey);
return general_error_handler($e, that: $this);
return handleError($e, $this);
}
}
public function checkConnection()
{
try {
['uptime' => $uptime, 'dockerVersion' => $dockerVersion] = validateServer($this->server);
['uptime' => $uptime, 'dockerVersion' => $dockerVersion] = validateServer($this->server, true);
if ($uptime) {
$this->emit('success', 'Server is reachable with this private key.');
} else {
@@ -48,7 +48,7 @@ class ShowPrivateKey extends Component
$this->emit('error', 'Old (lower than 23) or no Docker version detected. Install Docker Engine on the General tab.');
}
} catch (\Throwable $e) {
throw new \Exception($e->getMessage());
return handleError($e, $this);
}
}

View File

@@ -51,7 +51,7 @@ class Email extends Component
$this->settings->save();
$this->emit('success', 'Settings saved successfully.');
} catch (\Throwable $e) {
return general_error_handler($e, $this);
return handleError($e, $this);
}
}
public function submitResend() {
@@ -64,7 +64,7 @@ class Email extends Component
$this->emit('success', 'Settings saved successfully.');
} catch (\Throwable $e) {
$this->settings->resend_enabled = false;
return general_error_handler($e, $this);
return handleError($e, $this);
}
}
public function instantSaveResend() {
@@ -72,7 +72,7 @@ class Email extends Component
$this->settings->smtp_enabled = false;
$this->submitResend();
} catch (\Throwable $e) {
return general_error_handler($e, $this);
return handleError($e, $this);
}
}
public function instantSave()
@@ -81,7 +81,7 @@ class Email extends Component
$this->settings->resend_enabled = false;
$this->submit();
} catch (\Throwable $e) {
return general_error_handler($e, $this);
return handleError($e, $this);
}
}
@@ -100,7 +100,7 @@ class Email extends Component
$this->settings->save();
$this->emit('success', 'Settings saved successfully.');
} catch (\Throwable $e) {
return general_error_handler($e, $this);
return handleError($e, $this);
}
}

View File

@@ -52,7 +52,7 @@ class Change extends Component
$this->validate();
$this->github_app->save();
} catch (\Throwable $e) {
return general_error_handler(err: $e, that: $this);
return handleError($e, $this);
}
}
@@ -66,7 +66,7 @@ class Change extends Component
$this->github_app->delete();
redirect()->route('source.all');
} catch (\Throwable $e) {
return general_error_handler(err: $e, that: $this);
return handleError($e, $this);
}
}
}

View File

@@ -50,7 +50,7 @@ class Create extends Component
}
redirect()->route('source.github.show', ['github_app_uuid' => $github_app->uuid]);
} catch (\Throwable $e) {
return general_error_handler(err: $e, that: $this);
return handleError($e, $this);
}
}
}

View File

@@ -31,7 +31,7 @@ class Actions extends Component
$this->emit('reloadWindow', 5000);
}
} catch (\Throwable $e) {
return general_error_handler($e, $this);
return handleError($e, $this);
}
}
public function resume()
@@ -66,7 +66,7 @@ class Actions extends Component
$this->emit('reloadWindow', 5000);
}
} catch (\Throwable $e) {
return general_error_handler($e, $this);
return handleError($e, $this);
}
}
public function stripeCustomerPortal() {

View File

@@ -32,7 +32,7 @@ class Create extends Component
refreshSession();
return redirect()->route('team.index');
} catch (\Throwable $e) {
return general_error_handler($e, $this);
return handleError($e, $this);
}
}
}

View File

@@ -28,7 +28,7 @@ class Form extends Component
try {
$this->team->save();
} catch (\Throwable $e) {
return general_error_handler($e, $this);
return handleError($e, $this);
}
}
}

View File

@@ -36,7 +36,7 @@ class InviteLink extends Component
try {
$member_emails = currentTeam()->members()->get()->pluck('email');
if ($member_emails->contains($this->email)) {
return general_error_handler(that: $this, customErrorMessage: "$this->email is already a member of " . currentTeam()->name . ".");
return handleError(livewire: $this, customErrorMessage: "$this->email is already a member of " . currentTeam()->name . ".");
}
$uuid = new Cuid2(32);
$link = url('/') . config('constants.invitation.link.base_url') . $uuid;
@@ -57,7 +57,7 @@ class InviteLink extends Component
if (!is_null($invitation)) {
$invitationValid = $invitation->isValid();
if ($invitationValid) {
return general_error_handler(that: $this, customErrorMessage: "Pending invitation already exists for $this->email.");
return handleError(livewire: $this, customErrorMessage: "Pending invitation already exists for $this->email.");
} else {
$invitation->delete();
}
@@ -91,7 +91,7 @@ class InviteLink extends Component
if ($e->getCode() === '23505') {
$error_message = 'Invitation already sent.';
}
return general_error_handler(err: $e, that: $this, customErrorMessage: $error_message);
return handleError(error: $e, livewire: $this, customErrorMessage: $error_message);
}
}
}

View File

@@ -68,7 +68,7 @@ class Create extends Component
$this->storage->save();
return redirect()->route('team.storages.show', $this->storage->uuid);
} catch (\Throwable $e) {
return general_error_handler($e, $this);
return handleError($e, $this);
}
}
@@ -78,7 +78,7 @@ class Create extends Component
$this->storage->testConnection();
return $this->emit('success', 'Connection is working. Tested with "ListObjectsV2" action.');
} catch (\Throwable $e) {
return general_error_handler($e, $this);
return handleError($e, $this);
}
}
}

View File

@@ -33,7 +33,7 @@ class Form extends Component
$this->storage->testConnection();
return $this->emit('success', 'Connection is working. Tested with "ListObjectsV2" action.');
} catch (\Throwable $e) {
return general_error_handler($e, $this);
return handleError($e, $this);
}
}
@@ -43,7 +43,7 @@ class Form extends Component
$this->storage->delete();
return redirect()->route('team.storages.all');
} catch (\Throwable $e) {
return general_error_handler($e, $this);
return handleError($e, $this);
}
}
@@ -56,7 +56,7 @@ class Form extends Component
$this->storage->save();
$this->emit('success', 'Storage settings saved.');
} catch (\Throwable $e) {
return general_error_handler($e, $this);
return handleError($e, $this);
}
}
}

View File

@@ -38,7 +38,7 @@ class Upgrade extends Component
resolve(UpdateCoolify::class)(true);
Toaster::success("Upgrading to {$this->latestVersion} version...");
} catch (\Throwable $e) {
return general_error_handler(err: $e, that: $this);
return handleError($e, $this);
}
}
}

View File

@@ -54,7 +54,7 @@ class Index extends Component
$this->emit('success', 'Check your email to verify your email address.');
dispatch(new SendConfirmationForWaitlistJob($this->email, $waitlist->uuid));
} catch (\Throwable $e) {
return general_error_handler(err: $e, that: $this);
return handleError($e, $this);
}
}
}