diff --git a/src/ClientServer/Config/Constants.cs b/src/ClientServer/Config/Constants.cs index ad463b642b7870198787a3bb25b2745fc68a6979..f331451ea8556a50b26718d9fe7e0c04fa65a9f2 100644 --- a/src/ClientServer/Config/Constants.cs +++ b/src/ClientServer/Config/Constants.cs @@ -13,7 +13,7 @@ namespace ClientServer.Helpers /// </summary> public static class Constants { - public static string VersionString = "2.5.11"; + public static string VersionString = "2.5.12"; /// <summary> /// this is only set once at program.cs!! diff --git a/src/ClientServer/Controllers/ControllerWithDb.cs b/src/ClientServer/Controllers/ControllerWithDb.cs index 5e6b0d01b6df23e1fe039f15d927dc90bd548fe8..ff2bc632de9135d8d1169f04508922a9d3d9a4b3 100644 --- a/src/ClientServer/Controllers/ControllerWithDb.cs +++ b/src/ClientServer/Controllers/ControllerWithDb.cs @@ -37,7 +37,7 @@ namespace ClientServer.Controllers if (AppConfiguration.IsDebugMode) { return - Response.WriteAsync(Jc.Serialize(new BasicResponse(ResponseCode.ServerError, ex.ToString()))); + Response.WriteAsync(Jc.Serialize(new BasicResponse(ResponseCode.ServerError, ex.Message))); } return diff --git a/src/ClientServer/Controllers/Core/Testing/TestingController.cs b/src/ClientServer/Controllers/Core/Testing/TestingController.cs index e9d623b8c4371c7030798815e8e29e8bdd2b662b..657ca4d2147967666dc06ac661f37ebb6ed5d58b 100644 --- a/src/ClientServer/Controllers/Core/Testing/TestingController.cs +++ b/src/ClientServer/Controllers/Core/Testing/TestingController.cs @@ -210,12 +210,13 @@ namespace ClientServer.Controllers.Core.Testing } catch (Exception ex) { + //all request related errors should be caught in _RunTestOnTestServer ... so we should not get here Console.WriteLine("ERROR: test server timeout hit?: " + ex); //probably timeout hit (not from the test program but the request string reason = ""; if (AppConfiguration.IsDebugMode) { - reason = ", error: " + ex; + reason = ", error: " + ex.Message; //only show msg to frontend not the full trace... } await @@ -356,12 +357,13 @@ namespace ClientServer.Controllers.Core.Testing } catch (Exception ex) { + //all request related errors should be caught in _RunTestOnTestServer ... so we should not get here Console.WriteLine("ERROR: test server timeout hit?: " + ex); //probably timeout hit (not from the test program but the request string reason = ""; if (AppConfiguration.IsDebugMode) { - reason = ", error: " + ex; + reason = ", error: " + ex.Message; } await @@ -527,12 +529,13 @@ namespace ClientServer.Controllers.Core.Testing } catch (Exception ex) { + //all request related errors should be caught in _RunTestOnTestServer ... so we should not get here Console.WriteLine("ERROR: test server timeout hit?: " + ex); //probably timeout hit (not from the test program but the request string reason = ""; if (AppConfiguration.IsDebugMode) { - reason = ", error: " + ex; + reason = ", error: " + ex.Message; } await @@ -1417,13 +1420,13 @@ namespace ClientServer.Controllers.Core.Testing { allTests = tests.Select(p => AllTest.CreateFrom(p, testFilesDict)).ToList(); } - catch (Exception e) + catch (Exception ex) { //we create this exception so it should be ok to send just the message... - Console.WriteLine("ERROR " + e); + Console.WriteLine("ERROR creating tests with test files: " + ex); await Response.WriteAsync( - Jc.Serialize(new BasicResponse(ResponseCode.NotFound, e.Message))); + Jc.Serialize(new BasicResponse(ResponseCode.NotFound, ex.Message))); return; } @@ -1539,8 +1542,8 @@ namespace ClientServer.Controllers.Core.Testing oldResult.TimeForUserProgram = testResult.TimeForUserProgram; oldResult.TimeoutInMsUsed = testResult.TimeoutInMsUsed; oldResult.CompileTimeoutInMsUsed = testResult.CompileTimeoutInMsUsed; - oldResult.CharacterLimitExceeded = testResult.CharacterLimitExceeded; - oldResult.CharacterLimitUsed = testResult.CharacterLimitUsed; + oldResult.CharacterLimitExceeded = testResult.CharacterLimitExceeded; + oldResult.CharacterLimitUsed = testResult.CharacterLimitUsed; } try @@ -1550,7 +1553,7 @@ namespace ClientServer.Controllers.Core.Testing catch (Exception ex) { await base.HandleDbError(ex); - return; + return; } } @@ -1793,13 +1796,13 @@ namespace ClientServer.Controllers.Core.Testing { allTests = tests.Select(p => AllTest.CreateFrom(p, testFilesDict)).ToList(); } - catch (Exception e) + catch (Exception ex) { //we create this exception so it should be ok to send just the message... - Console.WriteLine("ERROR " + e); + Console.WriteLine("ERROR creating tests with test files: " + e); await Response.WriteAsync( - Jc.Serialize(new BasicResponse(ResponseCode.NotFound, e.Message))); + Jc.Serialize(new BasicResponse(ResponseCode.NotFound, ex.Message))); return; } @@ -1974,13 +1977,13 @@ namespace ClientServer.Controllers.Core.Testing { allTests = tests.Select(p => AllTest.CreateFrom(p, defaultCustomTestSettings, testFilesDict)).ToList(); } - catch (Exception e) + catch (Exception ex) { //we create this exception so it should be ok to send just the message... - Console.WriteLine("ERROR " + e); + Console.WriteLine("ERROR creating tests with test files: " + e); await Response.WriteAsync( - Jc.Serialize(new BasicResponse(ResponseCode.NotFound, e.Message))); + Jc.Serialize(new BasicResponse(ResponseCode.NotFound, ex.Message))); return; } @@ -2211,13 +2214,13 @@ namespace ClientServer.Controllers.Core.Testing { allTests = tests.Select(p => AllTest.CreateFrom(p, defaultCustomTestSettings, testFilesDict)).ToList(); } - catch (Exception e) + catch (Exception ex) { //we create this exception so it should be ok to send just the message... - Console.WriteLine("ERROR " + e); + Console.WriteLine("ERROR creating tests with test files: " + e); await Response.WriteAsync( - Jc.Serialize(new BasicResponse(ResponseCode.NotFound, e.Message))); + Jc.Serialize(new BasicResponse(ResponseCode.NotFound, ex.Message))); return; } @@ -2404,13 +2407,13 @@ namespace ClientServer.Controllers.Core.Testing { allTests = tests.Select(p => AllTest.CreateFrom(p, testFilesDict)).ToList(); } - catch (Exception e) + catch (Exception ex) { //we create this exception so it should be ok to send just the message... - Console.WriteLine("ERROR " + e); + Console.WriteLine("ERROR creating tests with test files: " + e); await Response.WriteAsync( - Jc.Serialize(new BasicResponse(ResponseCode.NotFound, e.Message))); + Jc.Serialize(new BasicResponse(ResponseCode.NotFound, ex.Message))); return; } @@ -2784,13 +2787,13 @@ namespace ClientServer.Controllers.Core.Testing { allTests = tests.Select(p => AllTest.CreateFrom(p, testFilesDict)).ToList(); } - catch (Exception e) + catch (Exception ex) { //we create this exception so it should be ok to send just the message... - Console.WriteLine("ERROR " + e); + Console.WriteLine("ERROR creating tests with test files: " + e); await Response.WriteAsync( - Jc.Serialize(new BasicResponse(ResponseCode.NotFound, e.Message))); + Jc.Serialize(new BasicResponse(ResponseCode.NotFound, ex.Message))); return; } @@ -2924,12 +2927,13 @@ namespace ClientServer.Controllers.Core.Testing } catch (Exception ex) { + //all request related errors should be caught in _RunTestOnTestServer ... so we should not get here Console.WriteLine("ERROR: test server timeout hit?: " + ex); //probably timeout hit (not from the test program but the request string reason = ""; if (AppConfiguration.IsDebugMode) { - reason = ", error: " + ex; + reason = ", error: " + ex.Message; } await @@ -3170,18 +3174,30 @@ namespace ClientServer.Controllers.Core.Testing } catch (Exception ex) { - Console.WriteLine("ERROR getting test server result: " + ex); - //throw; + errorDuringRequest = true; - - if (AppConfiguration.IsDebugMode) + errorMessageDuringRequest = "error during connecting to test server"; + + if (ex is TaskCanceledException) { - errorMessageDuringRequest = "error during connection to test server: " + ex; + //timeout hit... + Console.WriteLine("ERROR getting test server result: timeout was hit (task was canceled)"); + + if (AppConfiguration.IsDebugMode) + { + errorMessageDuringRequest = "error during connecting to test server: timeout was hit"; + } } else { - errorMessageDuringRequest = "error during connection to test server"; - } + //not a task timeout exception... get some more info + Console.WriteLine("ERROR getting test server result: " + ex); + + if (AppConfiguration.IsDebugMode) + { + errorMessageDuringRequest = "error during connecting to test server: " + ex; + } + } } }