1 /** 2 * Модуль содержит слассы ошибок и вспомогательные фунции 3 * 4 * Copyright: (c) 2015-2020, Milofon Project. 5 * License: Subject to the terms of the BSD 3-Clause License, as written in the included LICENSE.md file. 6 * Author: <m.galanin@milofon.pro> Maksim Galanin 7 * Date: 2020-04-15 8 */ 9 10 module dango.inject.exception; 11 12 private 13 { 14 import std.exception : basicExceptionCtors; 15 import std.format : fmt = format; 16 } 17 18 19 /** 20 * Base application exception 21 */ 22 class InjectDangoException : Exception 23 { 24 mixin basicExceptionCtors; 25 } 26 27 28 /** 29 * Exception thrown when errors occur while resolving a type in a dependency container. 30 */ 31 class ResolveDangoException : Exception 32 { 33 this(string message, TypeInfo resolveType) @safe 34 { 35 super(fmt!"Exception while resolving type %s: %s"( 36 resolveType.toString(), message)); 37 } 38 39 this(Throwable cause, TypeInfo resolveType) @safe 40 { 41 super(fmt!"Exception while resolving type %s"( 42 resolveType.toString()), cause); 43 } 44 } 45 46 47 /** 48 * Exception thrown when errors occur while registering a type in a dependency container. 49 */ 50 class RegistrationDangoException : Exception 51 { 52 this(string message, TypeInfo registrationType) @safe 53 { 54 super(fmt!("Exception while registering type %s: %s")( 55 registrationType.toString(), message)); 56 } 57 } 58