diff --git a/Blarg.GameFramework/Blarg.GameFramework.csproj b/Blarg.GameFramework/Blarg.GameFramework.csproj index e190414..476ba94 100644 --- a/Blarg.GameFramework/Blarg.GameFramework.csproj +++ b/Blarg.GameFramework/Blarg.GameFramework.csproj @@ -192,6 +192,7 @@ + diff --git a/Blarg.GameFramework/Graphics/Atlas/TextureAtlasAnimator.cs b/Blarg.GameFramework/Graphics/Atlas/TextureAtlasAnimator.cs index 54ee74f..8075a77 100644 --- a/Blarg.GameFramework/Graphics/Atlas/TextureAtlasAnimator.cs +++ b/Blarg.GameFramework/Graphics/Atlas/TextureAtlasAnimator.cs @@ -14,7 +14,7 @@ namespace Blarg.GameFramework.Graphics.Atlas { _contentManager = Framework.Services.Get(); if (_contentManager == null) - throw new InvalidOperationException("Could not find ContentManager object."); + throw new ServiceLocatorException("Could not find a ContentManager object."); _animations = new Dictionary(); } diff --git a/Blarg.GameFramework/Graphics/Atlas/TextureAtlasLoader.cs b/Blarg.GameFramework/Graphics/Atlas/TextureAtlasLoader.cs index 9b97030..f534eb2 100644 --- a/Blarg.GameFramework/Graphics/Atlas/TextureAtlasLoader.cs +++ b/Blarg.GameFramework/Graphics/Atlas/TextureAtlasLoader.cs @@ -34,7 +34,7 @@ namespace Blarg.GameFramework.Graphics.Atlas var contentManager = Framework.Services.Get(); if (contentManager == null) - throw new InvalidOperationException("Cannot find a ContentManager object."); + throw new ServiceLocatorException("Could not find a ContentManager object."); string textureFile = definition.Texture; if (!String.IsNullOrEmpty(texturePath)) diff --git a/Blarg.GameFramework/Graphics/ScreenEffects/ScreenEffectManager.cs b/Blarg.GameFramework/Graphics/ScreenEffects/ScreenEffectManager.cs index 629909d..e4a285a 100644 --- a/Blarg.GameFramework/Graphics/ScreenEffects/ScreenEffectManager.cs +++ b/Blarg.GameFramework/Graphics/ScreenEffects/ScreenEffectManager.cs @@ -18,7 +18,7 @@ namespace Blarg.GameFramework.Graphics.ScreenEffects _spriteBatch = Framework.Services.Get(); if (_spriteBatch == null) - throw new InvalidOperationException("No SpriteBatch object registered with the service locator."); + throw new ServiceLocatorException("Could not find a SpriteBatch object."); } #region Get / Add / Remove diff --git a/Blarg.GameFramework/ServiceLocatorException.cs b/Blarg.GameFramework/ServiceLocatorException.cs new file mode 100644 index 0000000..623c4d1 --- /dev/null +++ b/Blarg.GameFramework/ServiceLocatorException.cs @@ -0,0 +1,23 @@ +using System; + +namespace Blarg.GameFramework +{ + public class ServiceLocatorException : Exception + { + public ServiceLocatorException() + : base() + { + } + + public ServiceLocatorException(String message) + : base(message) + { + } + + public ServiceLocatorException(String message, Exception innerException) + : base(message, innerException) + { + } + } +} +