diff --git a/OpenDreamRuntime/DreamManager.cs b/OpenDreamRuntime/DreamManager.cs index 1cc0d988cb..ad12c2d9af 100644 --- a/OpenDreamRuntime/DreamManager.cs +++ b/OpenDreamRuntime/DreamManager.cs @@ -301,7 +301,7 @@ public DreamValue LocateRef(string refString) { return DreamValue.Null; } - public void HandleException(Exception e, string msg = "", string file = "", string line = "") { + public void HandleException(Exception e, string msg = "", string file = "", int line = 0) { if (string.IsNullOrEmpty(msg)) { // Just print the C# exception if we don't override the message msg = e.Message; } diff --git a/OpenDreamRuntime/DreamThread.cs b/OpenDreamRuntime/DreamThread.cs index 265ae4b1cc..5f31db2120 100644 --- a/OpenDreamRuntime/DreamThread.cs +++ b/OpenDreamRuntime/DreamThread.cs @@ -387,13 +387,13 @@ public void HandleException(Exception exception) { // Instantiate an /exception and invoke world.Error() string file = string.Empty; - int? line = null; + int line = 0; if(_current is DMProcState dmProc) { // TODO: Cope with the other ProcStates var source = dmProc.GetExceptionSource(); file = source.Item1; line = source.Item2; } - dreamMan.HandleException(exception, msg, file, line?.ToString() ?? string.Empty); + dreamMan.HandleException(exception, msg, file, line); IoCManager.Resolve().HandleException(this, exception); } diff --git a/OpenDreamRuntime/Objects/Types/DreamObjectException.cs b/OpenDreamRuntime/Objects/Types/DreamObjectException.cs index 1bef9aa605..a45c09017a 100644 --- a/OpenDreamRuntime/Objects/Types/DreamObjectException.cs +++ b/OpenDreamRuntime/Objects/Types/DreamObjectException.cs @@ -4,7 +4,7 @@ public sealed class DreamObjectException(DreamObjectDefinition objectDefinition) public string Name = string.Empty; public string Description = string.Empty; public string File = string.Empty; - public string Line = string.Empty; + public int Line = 0; //TODO: Match the format of BYOND exceptions since SS13 does splittext and other things to extract data from exceptions diff --git a/OpenDreamRuntime/Procs/DMProc.cs b/OpenDreamRuntime/Procs/DMProc.cs index 352f65c3e3..565d9c95fc 100644 --- a/OpenDreamRuntime/Procs/DMProc.cs +++ b/OpenDreamRuntime/Procs/DMProc.cs @@ -437,7 +437,7 @@ public override void AppendStackFrame(StringBuilder builder) { builder.Append(Proc.GetSourceAtOffset(_pc - 1).Line); } - public (string, int) GetExceptionSource() { + public (string, int) GetCurrentSource() { return Proc.GetSourceAtOffset(_pc - 1); }