문제

I have a static constructor like this:

File errorLog;
static this() {
    try {
        errorLog = File("./log/log.txt", "w");
    } catch(Throwable ex) {
        // STOP PROGRAM EXECUTION
    }
}

How would I stop the program execution when the opening of the file fails?

도움이 되었습니까?

해결책

Use core.runtime to terminate druntime http://dlang.org/phobos/core_runtime.html#.Runtime.terminate and exit from core.stdc.stdlib

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top