1 module toml_foolery.decode.exceptions; 2 3 4 /// Thrown by `parseToml` if the given data is in any way invalid. 5 public class TomlDecodingException : Exception 6 { 7 /// See `Exception.this()` 8 package this(string msg, string file = __FILE__, size_t line = __LINE__, Throwable nextInChain = null) 9 @nogc @safe pure nothrow 10 { 11 super(msg, file, line, nextInChain); 12 } 13 14 /// ditto 15 package this(string msg, Throwable nextInChain, string file = __FILE__, size_t line = __LINE__) 16 @nogc @safe pure nothrow 17 { 18 super(msg, file, line, nextInChain); 19 } 20 } 21 22 /** 23 * Thrown by `parseToml` if the given TOML has invalid syntax. 24 * 25 * See Also: 26 * [TomlDecodingException] 27 */ 28 public class TomlSyntaxException : TomlDecodingException 29 { 30 /// See `TomlDecodingException.this()` 31 package this(string msg, string file = __FILE__, size_t line = __LINE__, Throwable nextInChain = null) 32 @nogc @safe pure nothrow 33 { 34 super(msg, file, line, nextInChain); 35 } 36 37 /// ditto 38 package this(string msg, Throwable nextInChain, string file = __FILE__, size_t line = __LINE__) 39 @nogc @safe pure nothrow 40 { 41 super(msg, file, line, nextInChain); 42 } 43 } 44 45 /** 46 * Thrown by `parseToml` if the given TOML declares the same key or table twice. 47 * 48 * See Also: 49 * [TomlDecodingException] 50 */ 51 public class TomlDuplicateNameException : TomlDecodingException 52 { 53 /// See `TomlDecodingException.this()` 54 package this(string msg, string file = __FILE__, size_t line = __LINE__, Throwable nextInChain = null) 55 @nogc @safe pure nothrow 56 { 57 super(msg, file, line, nextInChain); 58 } 59 60 /// ditto 61 package this(string msg, Throwable nextInChain, string file = __FILE__, size_t line = __LINE__) 62 @nogc @safe pure nothrow 63 { 64 super(msg, file, line, nextInChain); 65 } 66 } 67 68 /** 69 * Thrown by `parseToml` when encountering TOML features not yet supported by the library. 70 * 71 * See Also: 72 * [TomlDecodingException] 73 */ 74 public class TomlUnsupportedException : TomlDecodingException 75 { 76 /// See `TomlDecodingException.this()` 77 package this(string msg, string file = __FILE__, size_t line = __LINE__, Throwable nextInChain = null) 78 @nogc @safe pure nothrow 79 { 80 super(msg, file, line, nextInChain); 81 } 82 83 /// ditto 84 package this(string msg, Throwable nextInChain, string file = __FILE__, size_t line = __LINE__) 85 @nogc @safe pure nothrow 86 { 87 super(msg, file, line, nextInChain); 88 } 89 } 90 91 /** 92 * Thrown by `parseToml` if the given TOML contains invalid (but syntactically correct) values. 93 * 94 * See Also: 95 * [TomlDecodingException] 96 */ 97 public class TomlInvalidValueException : TomlDecodingException 98 { 99 /// See `TomlDecodingException.this()` 100 package this(string msg, string file = __FILE__, size_t line = __LINE__, Throwable nextInChain = null) 101 @nogc @safe pure nothrow 102 { 103 super(msg, file, line, nextInChain); 104 } 105 106 /// ditto 107 package this(string msg, Throwable nextInChain, string file = __FILE__, size_t line = __LINE__) 108 @nogc @safe pure nothrow 109 { 110 super(msg, file, line, nextInChain); 111 } 112 } 113 114 /** 115 * Thrown by `parseToml` if the given TOML's data doesn't match a destination field type. 116 * 117 * See Also: 118 * [TomlDecodingException] 119 */ 120 public class TomlTypeException : TomlDecodingException 121 { 122 /// See `TomlDecodingException.this()` 123 package this(string msg, string file = __FILE__, size_t line = __LINE__, Throwable nextInChain = null) 124 @nogc @safe pure nothrow 125 { 126 super(msg, file, line, nextInChain); 127 } 128 129 /// ditto 130 package this(string msg, Throwable nextInChain, string file = __FILE__, size_t line = __LINE__) 131 @nogc @safe pure nothrow 132 { 133 super(msg, file, line, nextInChain); 134 } 135 }