From 0fc0a1fe46ff8363f853198bf929b416f167b95b Mon Sep 17 00:00:00 2001 From: Stone_Red <56473591+Stone-Red-Code@users.noreply.github.com> Date: Thu, 13 Jan 2022 15:01:41 +0100 Subject: [PATCH] - Add custom exceptions --- YesNt.Interpreter/Statements/CodeFlowStatements.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/YesNt.Interpreter/Statements/CodeFlowStatements.cs b/YesNt.Interpreter/Statements/CodeFlowStatements.cs index 55ff3ce..78d4d64 100644 --- a/YesNt.Interpreter/Statements/CodeFlowStatements.cs +++ b/YesNt.Interpreter/Statements/CodeFlowStatements.cs @@ -165,5 +165,17 @@ namespace YesNt.Interpreter.Statements RuntimeInfo.Exit("Planned termination by code. Canceling all tasks", true); } + + [Statement("trw", SearchMode.StartOfLine, SpaceAround.End, ConsoleColor.Red)] + public void Throw(string message) + { + RuntimeInfo.Exit(message, true); + } + + [Statement("err", SearchMode.StartOfLine, SpaceAround.End, ConsoleColor.Red)] + public void Error(string message) + { + RuntimeInfo.Exit(message, false); + } } } \ No newline at end of file