Skip to content

Commit 68485b2

Browse files
authored
Merge pull request #1562 from SoftUni-Internal/1664-improve-exceptiontype-in-submission-execution
Fixed a bug related to the exception type.
2 parents ed8222f + 378831c commit 68485b2

File tree

2 files changed

+33
-2
lines changed

2 files changed

+33
-2
lines changed

Servers/Worker/OJS.Servers.Worker/Models/ExecutionResult/FullExecutionResultResponseModel.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
public class FullExecutionResultResponseModel
77
{
8-
public ExceptionModel? Exception { get; set; }
8+
public LegacyExceptionModel? Exception { get; set; }
99

1010
public ExecutionResultResponseModel? ExecutionResult { get; set; }
1111

@@ -21,7 +21,7 @@ public void SetExecutionResult(ExecutionResultResponseModel executionResult)
2121

2222
public void SetException(Exception exception, bool includeStackTrace, ExceptionType? exceptionType = null)
2323
{
24-
this.Exception = new ExceptionModel(exception, includeStackTrace, exceptionType);
24+
this.Exception = new LegacyExceptionModel(exception, includeStackTrace, exceptionType);
2525
this.ExecutionResult = null;
2626
}
2727

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
namespace OJS.Workers.Common.Models;
2+
3+
using OJS.Workers.Common.Extensions;
4+
5+
public class LegacyExceptionModel
6+
{
7+
// Used to deserialize from json
8+
public LegacyExceptionModel()
9+
{
10+
}
11+
12+
public LegacyExceptionModel(
13+
Exception exception,
14+
bool includeStackTrace = false,
15+
ExceptionType? exceptionType = null)
16+
{
17+
this.Message = exception.GetAllMessages();
18+
this.ExceptionType = exceptionType.ToString();
19+
20+
if (includeStackTrace)
21+
{
22+
this.StackTrace = exception.GetBaseException().StackTrace;
23+
}
24+
}
25+
26+
public string? Message { get; set; }
27+
28+
public string? StackTrace { get; set; }
29+
30+
public string? ExceptionType { get; set; }
31+
}

0 commit comments

Comments
 (0)