Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed CodeStandardException. #257

Merged
merged 1 commit into from
Jul 20, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/CatLib.Core.Tests/CatLib/TestsApplication.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public void TestGetFileVersion()
}

[TestMethod]
[ExpectedException(typeof(CodeStandardException))]
[ExpectedException(typeof(LogicException))]
public void TestBootstrapRepeat()
{
application.Bootstrap();
Expand All @@ -50,7 +50,7 @@ public void TestBootstrapRepeat()
}

[TestMethod]
[ExpectedException(typeof(CodeStandardException))]
[ExpectedException(typeof(LogicException))]
public void TestInitRepeat()
{
application.Bootstrap();
Expand All @@ -59,7 +59,7 @@ public void TestInitRepeat()
}

[TestMethod]
[ExpectedException(typeof(CodeStandardException))]
[ExpectedException(typeof(LogicException))]
public void TestInitNoBootstrap()
{
application.Init();
Expand Down Expand Up @@ -116,7 +116,7 @@ public void TestRegisterRepeat()
}

[TestMethod]
[ExpectedExceptionAndMessage(typeof(CodeStandardException))]
[ExpectedExceptionAndMessage(typeof(LogicException))]
public void TestInitingRegister()
{
var foo = new Mock<IServiceProvider>();
Expand All @@ -133,7 +133,7 @@ public void TestInitingRegister()
}

[TestMethod]
[ExpectedExceptionAndMessage(typeof(CodeStandardException))]
[ExpectedExceptionAndMessage(typeof(LogicException))]
public void TestTerminateRegister()
{
var foo = new Mock<IServiceProvider>();
Expand Down Expand Up @@ -214,7 +214,7 @@ public void TestInitAfterRegister()
}

[TestMethod]
[ExpectedException(typeof(CodeStandardException))]
[ExpectedException(typeof(LogicException))]
public void TestRegistingMake()
{
var foo = new Mock<IServiceProvider>();
Expand Down
12 changes: 6 additions & 6 deletions src/CatLib.Core.Tests/Container/TestsContainer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ public void TestBindIllegal()
container.Bind(null, (container, args) => "invalid service name", false);
});

Assert.ThrowsException<CodeStandardException>(() =>
Assert.ThrowsException<LogicException>(() =>
{
container.Bind("$foo", (container, args) => "Illegal placeholder", false);
});
Expand Down Expand Up @@ -234,7 +234,7 @@ public void TestAlias()
}

[TestMethod]
[DataRow("bar-alias", "bar", typeof(CodeStandardException), "Set an alias for a service that does not exist.")]
[DataRow("bar-alias", "bar", typeof(LogicException), "Set an alias for a service that does not exist.")]
[DataRow(null, "bar", typeof(ArgumentNullException), "Alias name is null.")]
[DataRow("baz", null, typeof(ArgumentNullException), "Service name is null.")]
[DataRow("foo", "foo", typeof(LogicException), "Alias is same as service")]
Expand Down Expand Up @@ -652,7 +652,7 @@ public void TestInstance()
}

[TestMethod]
[ExpectedException(typeof(CodeStandardException))]
[ExpectedException(typeof(LogicException))]
[DataRow("foo:bar")]
[DataRow("$foo")]
[DataRow("foo@bar")]
Expand All @@ -662,7 +662,7 @@ public void TestInstanceIllegalChars(string service)
}

[TestMethod]
[ExpectedException(typeof(CodeStandardException))]
[ExpectedException(typeof(LogicException))]
public void TestInstanceNotAllowedSameObject()
{
var foo = new object();
Expand Down Expand Up @@ -750,7 +750,7 @@ public void TestFlush()
}

[TestMethod]
[ExpectedException(typeof(CodeStandardException))]
[ExpectedException(typeof(LogicException))]
public void TestFlushInstanceService()
{
container.Bind("foo", typeof(Foo), true)
Expand Down Expand Up @@ -822,7 +822,7 @@ public void TestVariantForceGivenNull()
}

[TestMethod]
[ExpectedException(typeof(CodeStandardException))]
[ExpectedException(typeof(LogicException))]
public void TestReboundNotExistsService()
{
container.OnRebound("foobar", (instance) =>
Expand Down
12 changes: 6 additions & 6 deletions src/CatLib.Core/CatLib/Application.cs
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ public virtual void Bootstrap(params IBootstrap[] bootstraps)

if (bootstrapped || Process != StartProcess.Construct)
{
throw new CodeStandardException($"Cannot repeatedly trigger the {nameof(Bootstrap)}()");
throw new LogicException($"Cannot repeatedly trigger the {nameof(Bootstrap)}()");
}

Process = StartProcess.Bootstrap;
Expand Down Expand Up @@ -239,12 +239,12 @@ public virtual void Init()
{
if (!bootstrapped)
{
throw new CodeStandardException($"You must call {nameof(Bootstrap)}() first.");
throw new LogicException($"You must call {nameof(Bootstrap)}() first.");
}

if (inited || Process != StartProcess.Bootstraped)
{
throw new CodeStandardException($"Cannot repeatedly trigger the {nameof(Init)}()");
throw new LogicException($"Cannot repeatedly trigger the {nameof(Init)}()");
}

Process = StartProcess.Init;
Expand Down Expand Up @@ -281,12 +281,12 @@ public virtual void Register(IServiceProvider provider, bool force = false)

if (Process == StartProcess.Initing)
{
throw new CodeStandardException($"Unable to add service provider during {nameof(StartProcess.Initing)}");
throw new LogicException($"Unable to add service provider during {nameof(StartProcess.Initing)}");
}

if (Process > StartProcess.Running)
{
throw new CodeStandardException($"Unable to {nameof(Terminate)} in-process registration service provider");
throw new LogicException($"Unable to {nameof(Terminate)} in-process registration service provider");
}

var skipped = Dispatch(new RegisterProviderEventArgs(provider, this))
Expand Down Expand Up @@ -342,7 +342,7 @@ protected override void GuardConstruct(string method)
{
if (registering)
{
throw new CodeStandardException(
throw new LogicException(
$"It is not allowed to make services or dependency injection in the {nameof(Register)} process, method:{method}");
}

Expand Down
10 changes: 5 additions & 5 deletions src/CatLib.Core/Container/Container.cs
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ public IContainer Alias(string alias, string service)

if (!bindings.ContainsKey(service) && !instances.ContainsKey(service))
{
throw new CodeStandardException(
throw new LogicException(
$"You must {nameof(Bind)}() or {nameof(Instance)}() serivce before and you be able to called {nameof(Alias)}().");
}

Expand Down Expand Up @@ -588,7 +588,7 @@ public object Instance(string service, object instance)
&& instancesReverse.TryGetValue(instance, out string realService)
&& realService != service)
{
throw new CodeStandardException($"The instance has been registered as a singleton in {realService}");
throw new LogicException($"The instance has been registered as a singleton in {realService}");
}

var isResolved = IsResolved(service);
Expand Down Expand Up @@ -715,7 +715,7 @@ public IContainer OnRebound(string service, Action<object> callback)

if (!IsResolved(service) && !CanMake(service))
{
throw new CodeStandardException(
throw new LogicException(
$"If you want use Rebound(Watch) , please {nameof(Bind)} or {nameof(Instance)} service first.");
}

Expand Down Expand Up @@ -1566,7 +1566,7 @@ protected virtual void GuardServiceName(string service)
{
if (service.IndexOf(c) >= 0)
{
throw new CodeStandardException(
throw new LogicException(
$"Service name {service} contains disabled characters : {c}. please use Alias replacement");
}
}
Expand Down Expand Up @@ -1720,7 +1720,7 @@ private void GuardFlushing()
{
if (flushing)
{
throw new CodeStandardException("Container is flushing can not do it");
throw new LogicException("Container is flushing can not do it");
}
}

Expand Down
60 changes: 0 additions & 60 deletions src/CatLib.Core/Support/Exception/CodeStandardException.cs

This file was deleted.