From d33595cdf0da82c14e7d12dd74a8cedbd9900cee Mon Sep 17 00:00:00 2001 From: Mike Wey Date: Thu, 3 Feb 2011 23:09:50 +0100 Subject: Some changes to the Exceptions --- dmagick/Utils.d | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'dmagick/Utils.d') diff --git a/dmagick/Utils.d b/dmagick/Utils.d index 1396ddf..d5e8ff6 100644 --- a/dmagick/Utils.d +++ b/dmagick/Utils.d @@ -10,6 +10,8 @@ module dmagick.Utils; import std.math; +import dmagick.Exception; + import dmagick.c.memory; import dmagick.c.magickString; import dmagick.c.magickType; @@ -21,7 +23,7 @@ import dmagick.c.magickType; void copyString(ref char[MaxTextExtent] dest, string source) { if ( source.length < MaxTextExtent ) - throw new Exception("text is to long"); //TODO: a proper exception. + throw new ResourceLimitException("Source is larger then MaxTextExtend", null); dest[0 .. source.length] = source; dest[source.length] = '\0'; @@ -44,7 +46,7 @@ void copyString(ref char* dest, string source) } if ( ~source.length < MaxTextExtent ) - throw new Exception("UnableToAcquireString"); //TODO: a proper exception. + throw new ResourceLimitException("unable to acquire string", null); if ( dest is null ) dest = cast(char*)AcquireQuantumMemory(source.length+MaxTextExtent, dest.sizeof); @@ -52,7 +54,7 @@ void copyString(ref char* dest, string source) dest = cast(char*)ResizeQuantumMemory(dest, source.length+MaxTextExtent, dest.sizeof); if ( dest is null ) - throw new Exception("UnableToAcquireString"); //TODO: a proper exception. + throw new ResourceLimitException("unable to acquire string", null); if ( source.length > 0 ) dest[0 .. source.length] = source; -- cgit v1.2.3