1 module lib.exception; 2 3 /** 4 Raised when a function receives an argument that has the right type. 5 */ 6 class ValueError : Error { 7 this(string msg) { 8 super("ValueError: " ~ msg); 9 } 10 } 11 12 13 /** 14 Raised when a mapping (dictionary) key is not found in the set of existing 15 keys. 16 */ 17 class KeyError : Error { 18 this(string msg) { 19 super("KeyError: " ~ msg); 20 } 21 } 22 23 24 /** 25 Raised when a sequence subscript is out of range. 26 */ 27 class IndexError : Error { 28 this(string msg) { 29 super("IndexError: " ~ msg); 30 } 31 }