- fix: Message on error
This commit is contained in:
@@ -174,6 +174,7 @@ public partial class ServerEntryModelView : ViewModelBase, IFilterConsumer, ILis
|
|||||||
|
|
||||||
private async Task RunInstanceAsync(bool ignoreLoginCredentials = false)
|
private async Task RunInstanceAsync(bool ignoreLoginCredentials = false)
|
||||||
{
|
{
|
||||||
|
_logger.Log("Running instance..." + RealName);
|
||||||
if (!ignoreLoginCredentials && AccountInfoViewModel.Credentials.Value is null)
|
if (!ignoreLoginCredentials && AccountInfoViewModel.Credentials.Value is null)
|
||||||
{
|
{
|
||||||
var warningContext = ViewHelperService.GetViewModel<IsLoginCredentialsNullPopupViewModel>()
|
var warningContext = ViewHelperService.GetViewModel<IsLoginCredentialsNullPopupViewModel>()
|
||||||
@@ -183,6 +184,8 @@ public partial class ServerEntryModelView : ViewModelBase, IFilterConsumer, ILis
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
using var loadingContext = ViewHelperService.GetViewModel<LoadingContextViewModel>();
|
using var loadingContext = ViewHelperService.GetViewModel<LoadingContextViewModel>();
|
||||||
loadingContext.LoadingName = "Loading instance...";
|
loadingContext.LoadingName = "Loading instance...";
|
||||||
((ILoadingHandler)loadingContext).AppendJob();
|
((ILoadingHandler)loadingContext).AppendJob();
|
||||||
@@ -190,12 +193,21 @@ public partial class ServerEntryModelView : ViewModelBase, IFilterConsumer, ILis
|
|||||||
PopupMessageService.Popup(loadingContext);
|
PopupMessageService.Popup(loadingContext);
|
||||||
_currentInstance =
|
_currentInstance =
|
||||||
await GameRunnerPreparer.GetGameProcessStartInfoProvider(Address, loadingContext, CancellationService.Token);
|
await GameRunnerPreparer.GetGameProcessStartInfoProvider(Address, loadingContext, CancellationService.Token);
|
||||||
|
_logger.Log("Preparing instance...");
|
||||||
_currentInstance.RegisterLogger(_currentContentLogConsumer);
|
_currentInstance.RegisterLogger(_currentContentLogConsumer);
|
||||||
_currentInstance.RegisterLogger(new DebugLoggerBridge(DebugService.GetLogger($"PROCESS_{Random.Shared.Next(65535)}")));
|
_currentInstance.RegisterLogger(new DebugLoggerBridge(DebugService.GetLogger($"PROCESS_{Random.Shared.Next(65535)}")));
|
||||||
_currentInstance.OnProcessExited += OnProcessExited;
|
_currentInstance.OnProcessExited += OnProcessExited;
|
||||||
RunVisible = false;
|
RunVisible = false;
|
||||||
_currentInstance.Start();
|
_currentInstance.Start();
|
||||||
|
_logger.Log("Starting instance..." + RealName);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
var error = new Exception("Error while attempt run instance", e);
|
||||||
|
_logger.Error(error);
|
||||||
|
PopupMessageService.Popup(error);
|
||||||
|
RunVisible = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnProcessExited(ProcessRunHandler<GameProcessStartInfoProvider> obj)
|
private void OnProcessExited(ProcessRunHandler<GameProcessStartInfoProvider> obj)
|
||||||
|
|||||||
@@ -2,15 +2,18 @@ using Nebula.Runner.Services;
|
|||||||
using Nebula.Shared;
|
using Nebula.Shared;
|
||||||
using Nebula.Shared.Models;
|
using Nebula.Shared.Models;
|
||||||
using Nebula.Shared.Services;
|
using Nebula.Shared.Services;
|
||||||
|
using Nebula.Shared.Services.Logging;
|
||||||
using Nebula.Shared.Utils;
|
using Nebula.Shared.Utils;
|
||||||
using Robust.LoaderApi;
|
using Robust.LoaderApi;
|
||||||
|
|
||||||
namespace Nebula.Runner;
|
namespace Nebula.Runner;
|
||||||
|
|
||||||
[ServiceRegister]
|
[ServiceRegister]
|
||||||
public sealed class App(RunnerService runnerService, ContentService contentService)
|
public sealed class App(RunnerService runnerService, ContentService contentService, DebugService debugService)
|
||||||
: IRedialApi
|
: IRedialApi
|
||||||
{
|
{
|
||||||
|
public ILogger logger = debugService.GetLogger("Runner");
|
||||||
|
|
||||||
public void Redial(Uri uri, string text = "")
|
public void Redial(Uri uri, string text = "")
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -22,6 +25,8 @@ public sealed class App(RunnerService runnerService, ContentService contentServi
|
|||||||
|
|
||||||
var url = urlraw.ToRobustUrl();
|
var url = urlraw.ToRobustUrl();
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
using var cancelTokenSource = new CancellationTokenSource();
|
using var cancelTokenSource = new CancellationTokenSource();
|
||||||
var buildInfo = await contentService.GetBuildInfo(url, cancelTokenSource.Token);
|
var buildInfo = await contentService.GetBuildInfo(url, cancelTokenSource.Token);
|
||||||
|
|
||||||
@@ -46,4 +51,10 @@ public sealed class App(RunnerService runnerService, ContentService contentServi
|
|||||||
|
|
||||||
await runnerService.Run(args.ToArray(), buildInfo, this, new ConsoleLoadingHandler(), cancelTokenSource.Token);
|
await runnerService.Run(args.ToArray(), buildInfo, this, new ConsoleLoadingHandler(), cancelTokenSource.Token);
|
||||||
}
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
logger.Error(e);
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user