// Used when we may need to register an error (for convenience like a macro) public void ASSERT_ERR(bool condition, CoreErrorType err_type, string msg = null) { if (condition) { push_err(err_type, msg); } }
public CoreError(CoreState state, TraceBack traceback, CoreErrorType type, string msg = null) { this.state = state; this.traceback = traceback; this.type = type; // Check if the error is fatal by checking the error type this.fatal = ((int)type) > 0; this.msg = msg; }
// Push an error to the cores' error handler public void push_err(CoreErrorType err_type, string msg = null) { CoreError err = new CoreError(this.state, this.traceback, err_type, msg); // Register the error with the handler this.state.err_handler.register_err(err); this.state.had_err = true; throw new CoreErrException(err); }