enforceEx

Deprecated. Please use enforce instead. This function will be removed 2.089.

If !value is false, value is returned. Otherwise, new E(msg, file, line) is thrown. Or if E doesn't take a message and can be constructed with new E(file, line), then new E(file, line) will be thrown.

  1. T enforceEx(T value, string msg, string file, size_t line)
    template enforceEx(E : Throwable)
    deprecated("Use `enforce`. `enforceEx` will be removed with 2.089.")
    T
    enforceEx
    (
    T
    )
    (,
    lazy string msg = ""
    ,
    string file = __FILE__
    ,
    size_t line = __LINE__
    )
    if (
    is(typeof(new E("", string.init, size_t.init)))
    )
  2. template enforceEx(E : Throwable)

Members

Functions

enforceEx
T enforceEx(T value, string msg, string file, size_t line)

Ditto

Examples

auto f = enforceEx!FileMissingException(fopen("data.txt"));
auto line = readln(f);
enforceEx!DataCorruptionException(line.length);

Meta

Suggestion Box / Bug Report