Skip to content

Commit 52d2066

Browse files
Improved error handling
1 parent 8f8b6fc commit 52d2066

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
# Entity Component System
88

9-
[![npm](https://img.shields.io/badge/upm-3.7.1-232c37.svg?style=for-the-badge)]()
9+
[![npm](https://img.shields.io/badge/upm-3.7.2-232c37.svg?style=for-the-badge)]()
1010
[![npm](https://img.shields.io/github/stars/elraccoone/unity-entity-component-system.svg?style=for-the-badge)]()
1111
[![npm](https://img.shields.io/badge/build-passing-brightgreen.svg?style=for-the-badge)]()
1212

Runtime/Controller.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ public virtual void OnUpdate () { }
108108
// done during 'OnInitialize' cycle.
109109
public void Register (params System.Type[] typesOf) {
110110
if (this.isInitialized == true)
111-
throw new System.Exception ("Unable to registered system outsize of OnInitialize cycle");
111+
throw new System.Exception ("Cannot to registered System outsize of OnInitialize cycle");
112112

113113
for (var _typeOfIndex = 0; _typeOfIndex < typesOf.Length; _typeOfIndex++) {
114114
var _instance = System.Activator.CreateInstance (typesOf[_typeOfIndex]);
@@ -183,15 +183,15 @@ public bool IsSystemEnabled<S> () {
183183
for (var _systemIndex = 0; _systemIndex < this.systems.Count; _systemIndex++)
184184
if (this.systems[_systemIndex].GetType () == _typeOfS)
185185
return (S)this.systems[_systemIndex];
186-
throw new System.Exception ("Unable to get system, it was not registerd to the controller");
186+
throw new System.Exception ($"Unable to get System of type {_typeOfS}, it was not registerd to the Controller");
187187
}
188188

189189
/// Gets a system from this controller.
190190
public System.Object GetSystem (System.Type typeOf) {
191191
for (var _systemIndex = 0; _systemIndex < this.systems.Count; _systemIndex++)
192192
if (this.systems[_systemIndex].GetType () == typeOf)
193193
return this.systems[_systemIndex];
194-
throw new System.Exception ("Unable to get system, it was not registerd to the controller");
194+
throw new System.Exception ($"Unable to get System of type {typeOf}, it was not registerd to the Controller");
195195
}
196196

197197
/// Check whether this controller has a system.
@@ -209,15 +209,15 @@ public System.Object GetSystem (System.Type typeOf) {
209209
for (var _serviceIndex = 0; _serviceIndex < this.services.Count; _serviceIndex++)
210210
if (this.services[_serviceIndex].GetType () == _typeOfS)
211211
return (S)this.services[_serviceIndex];
212-
throw new System.Exception ("Unable to get service, it was not registerd to the controller");
212+
throw new System.Exception ($"Unable to get Service of type {_typeOfS}, it was not registerd to the Controller");
213213
}
214214

215215
/// Gets a system from this controller.
216216
public System.Object GetService (System.Type typeOf) {
217217
for (var _serviceIndex = 0; _serviceIndex < this.services.Count; _serviceIndex++)
218218
if (this.services[_serviceIndex].GetType () == typeOf)
219219
return this.services[_serviceIndex];
220-
throw new System.Exception ("Unable to get service, it was not registerd to the controller");
220+
throw new System.Exception ($"Unable to get Service of type {typeOf}, it was not registerd to the Controller");
221221
}
222222

223223
/// Check whether this controller has a service.
@@ -234,7 +234,7 @@ public UnityEngine.Object GetAsset (string name) {
234234
for (var _i = 0; _i < this.assets.Length; _i++)
235235
if (this.assets[_i].name == name)
236236
return this.assets[_i];
237-
throw new System.Exception ($"Unable to get asset '{name}', it was not found on the controller");
237+
throw new System.Exception ($"Unable to get Asset '{name}', it was not found on the Controller");
238238
}
239239

240240
/// Gets an asset from this controller.

Runtime/EntityComponent.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ private EntitySystemType GetSystem () {
2020
if (this.system == null)
2121
if (Controller.Instance.HasSystem<EntitySystemType> () == true)
2222
this.system = Controller.Instance.GetSystem<EntitySystemType> ();
23-
else throw new System.Exception ("Tried to access the system before it was registered");
23+
else throw new System.Exception ("Tried to access the System before it was registered");
2424
return this.system;
2525
}
2626

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "nl.elraccoone.entity-component-system",
33
"displayName": "Entity Component System",
4-
"version": "3.7.1",
4+
"version": "3.7.2",
55
"unity": "2019.1",
66
"description": "A better approach to game design that allows you to concentrate on the actual problems you are solving: the data and behavior that make up your game. By moving from object-oriented to data-oriented design it will be easier for you to reuse the code and easier for others to understand and work on it."
77
}

0 commit comments

Comments
 (0)