1 module daffodil.util.errors; 2 3 public import std.exception; 4 5 /// Create a basic exception subclass with the default exception constructor. 6 mixin template classException(string name, base = Exception) { 7 mixin(q{ 8 class }~name~q{ : base { 9 @safe pure nothrow this(string m, string f = __FILE__, size_t l = __LINE__, Throwable n = null ) { 10 super(m, f, l, n); 11 } 12 } 13 }); 14 } 15 16 /// Exception thrown when a image failed to load 17 mixin classException!"ImageException"; 18 19 /// Exception thrown when the header for an image is invalid 20 mixin classException!("InvalidHeader", ImageException); 21 22 /// Exception thrown when image data was not in a required format, ie. wrong file type 23 mixin classException!("InvalidImageType", ImageException); 24 25 /// Exception thrown when a image has unsupported features. 26 mixin classException!("NotSupported", ImageException); 27 28 /// Exception thrown when the end of a file is reached before all expected data was read 29 mixin classException!("UnexpectedEndOfData", ImageException);