Core/Errors: Stop using System.Diagnostics.Contracts, Its just closing the server without error or warning. We now log the error and then throw a exception

This commit is contained in:
hondacrx
2018-06-15 12:34:56 -04:00
parent 1289bc3ed1
commit 7aa494d5dd
86 changed files with 520 additions and 558 deletions
+18 -1
View File
@@ -1,4 +1,21 @@
using System;
/*
* Copyright (C) 2012-2018 CypherCore <http://github.com/CypherCore>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using System;
using System.Collections.Generic;
using System.Linq;
+2 -3
View File
@@ -16,7 +16,6 @@
*/
using System.Collections.Generic;
using System.Diagnostics.Contracts;
using System.Linq;
namespace Framework.Dynamic
@@ -112,13 +111,13 @@ namespace Framework.Dynamic
public void ScheduleAbort()
{
Contract.Assert(IsRunning(), "Tried to scheduled the abortion of an event twice!");
Cypher.Assert(IsRunning(), "Tried to scheduled the abortion of an event twice!");
m_abortState = AbortState.Scheduled;
}
public void SetAborted()
{
Contract.Assert(!IsAborted(), "Tried to abort an already aborted event!");
Cypher.Assert(!IsAborted(), "Tried to abort an already aborted event!");
m_abortState = AbortState.Aborted;
}
+1 -2
View File
@@ -16,7 +16,6 @@
*/
using Framework.Collections;
using System.Diagnostics.Contracts;
namespace Framework.Dynamic
{
@@ -42,7 +41,7 @@ namespace Framework.Dynamic
// Create new link
public void link(TO toObj, FROM fromObj)
{
Contract.Assert(fromObj != null); // fromObj MUST not be NULL
Cypher.Assert(fromObj != null); // fromObj MUST not be NULL
if (isValid())
unlink();
if (toObj != null)
+1 -2
View File
@@ -17,7 +17,6 @@
using System;
using System.Collections.Generic;
using System.Diagnostics.Contracts;
using System.Linq;
namespace Framework.Dynamic
@@ -622,7 +621,7 @@ namespace Framework.Dynamic
{
// This was adapted to TC to prevent static analysis tools from complaining.
// If you encounter this assertion check if you repeat a TaskContext more then 1 time!
Contract.Assert(!_consumed, "Bad task logic, task context was consumed already!");
Cypher.Assert(!_consumed, "Bad task logic, task context was consumed already!");
}
/// <summary>