Handle error in response
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
using SPTarkov.DI.Annotations;
|
||||
using SPTarkov.Server.Core.Controllers;
|
||||
using SPTarkov.Server.Core.DI;
|
||||
using SPTarkov.Server.Core.Exceptions.Profile;
|
||||
using SPTarkov.Server.Core.Models.Common;
|
||||
using SPTarkov.Server.Core.Models.Eft.Common;
|
||||
using SPTarkov.Server.Core.Models.Eft.Common.Request;
|
||||
@@ -45,7 +44,13 @@ public class GameCallbacks(
|
||||
{
|
||||
if (saveServer.IsProfileInvalidOrUnloadable(sessionID))
|
||||
{
|
||||
throw new ProfileIncompatibleException("This profile cannot be loaded due to it being invalid or unloadable!");
|
||||
return new ValueTask<string>(
|
||||
httpResponseUtil.GetBody(
|
||||
new GameStartResponse { UtcTime = 0 },
|
||||
Models.Enums.BackendErrorCodes.PlayerProfileNotFound,
|
||||
"This profile cannot be loaded due to it being invalid or unloadable!"
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
var startTimestampSec = timeUtil.GetTimeStamp();
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using SPTarkov.DI.Annotations;
|
||||
using SPTarkov.Server.Core.Exceptions.Profile;
|
||||
using SPTarkov.Server.Core.Extensions;
|
||||
using SPTarkov.Server.Core.Helpers;
|
||||
using SPTarkov.Server.Core.Models.Common;
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SPTarkov.Server.Core.Exceptions.Profile;
|
||||
|
||||
public class ProfileIncompatibleException : Exception
|
||||
{
|
||||
public ProfileIncompatibleException(string message)
|
||||
: base(message) { }
|
||||
|
||||
public ProfileIncompatibleException(string message, Exception innerException)
|
||||
: base(message, innerException) { }
|
||||
|
||||
public override string? StackTrace
|
||||
{
|
||||
get { return null; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user