aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/YEngine/XMRInstRun.cs
diff options
context:
space:
mode:
authorUbitUmarov2018-11-26 19:44:32 +0000
committerUbitUmarov2018-11-26 19:44:32 +0000
commit27da6f130193aebbfc2b8f4221831bbd15857b47 (patch)
treeed88cb7ce2d74cc5b9ba9938913b816792cda37b /OpenSim/Region/ScriptEngine/YEngine/XMRInstRun.cs
parentremove a ossl dev only option (diff)
downloadopensim-SC-27da6f130193aebbfc2b8f4221831bbd15857b47.zip
opensim-SC-27da6f130193aebbfc2b8f4221831bbd15857b47.tar.gz
opensim-SC-27da6f130193aebbfc2b8f4221831bbd15857b47.tar.bz2
opensim-SC-27da6f130193aebbfc2b8f4221831bbd15857b47.tar.xz
Yengine: simplify ossl severe error message, and make it on debug channel like Xengine
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/ScriptEngine/YEngine/XMRInstRun.cs86
1 files changed, 49 insertions, 37 deletions
diff --git a/OpenSim/Region/ScriptEngine/YEngine/XMRInstRun.cs b/OpenSim/Region/ScriptEngine/YEngine/XMRInstRun.cs
index ce0823d..1e5416f 100644
--- a/OpenSim/Region/ScriptEngine/YEngine/XMRInstRun.cs
+++ b/OpenSim/Region/ScriptEngine/YEngine/XMRInstRun.cs
@@ -444,8 +444,10 @@ namespace OpenSim.Region.ScriptEngine.Yengine
444 */ 444 */
445 private void HandleScriptException(Exception e) 445 private void HandleScriptException(Exception e)
446 { 446 {
447 // The script threw some kind of exception that was not caught at 447 // The script threw some kind of exception that was not caught at
448 // script level, so the script is no longer running an event handler. 448 // script level, so the script is no longer running an event handler.
449
450 ScriptEventCode curevent = eventCode;
449 eventCode = ScriptEventCode.None; 451 eventCode = ScriptEventCode.None;
450 stackFrames = null; 452 stackFrames = null;
451 453
@@ -464,19 +466,60 @@ namespace OpenSim.Region.ScriptEngine.Yengine
464 m_SleepUntil = DateTime.MaxValue; 466 m_SleepUntil = DateTime.MaxValue;
465 m_Engine.World.DeleteSceneObject(m_Part.ParentGroup, false); 467 m_Engine.World.DeleteSceneObject(m_Part.ParentGroup, false);
466 } 468 }
467 else if(e is ScriptResetException) 469 else if (e is ScriptResetException)
468 { 470 {
469 // Script did an llResetScript(). 471 // Script did an llResetScript().
470 m_RunOnePhase = "resetting..."; 472 m_RunOnePhase = "resetting...";
471 ResetLocked("HandleScriptResetException"); 473 ResetLocked("HandleScriptResetException");
472 } 474 }
475 else if (e is ScriptException)
476 {
477 // Some general script error.
478 SendScriptErrorMessage(e, curevent);
479 }
473 else 480 else
474 { 481 {
475 // Some general script error. 482 // Some general script error.
476 SendErrorMessage(e); 483 SendErrorMessage(e);
477 } 484 }
478 } 485 }
479 486
487 private void SendScriptErrorMessage(Exception e, ScriptEventCode ev)
488 {
489 StringBuilder msg = new StringBuilder();
490
491 msg.Append("YEngine: ");
492 if (e.Message != null)
493 msg.Append(e.Message);
494
495 msg.Append(" (prim: ");
496 msg.Append(m_Part.Name);
497
498 msg.Append(" script: ");
499 msg.Append(m_Item.Name);
500 msg.Append(" event: ");
501 msg.Append(ev.ToString());
502 msg.Append(" at: <");
503 Vector3 pos = m_Part.AbsolutePosition;
504 msg.Append((int)Math.Floor(pos.X));
505 msg.Append(',');
506 msg.Append((int)Math.Floor(pos.Y));
507 msg.Append(',');
508 msg.Append((int)Math.Floor(pos.Z));
509 msg.Append(">) Script must be Reset to re-enable.\n");
510
511 string msgst = msg.ToString();
512 if (msgst.Length > 1000)
513 msgst = msgst.Substring(0, 1000);
514
515 m_log.Info(msgst);
516 m_Engine.World.SimChat(Utils.StringToBytes(msgst),
517 ChatTypeEnum.DebugChannel, 2147483647,
518 m_Part.AbsolutePosition,
519 m_Part.Name, m_Part.UUID, false);
520 m_SleepUntil = DateTime.MaxValue;
521 }
522
480 /** 523 /**
481 * @brief There was an exception running script event handler. 524 * @brief There was an exception running script event handler.
482 * Display error message and disable script (in a way 525 * Display error message and disable script (in a way
@@ -536,41 +579,10 @@ namespace OpenSim.Region.ScriptEngine.Yengine
536 continue; 579 continue;
537 } 580 }
538 this.llOwnerSay(line); 581 this.llOwnerSay(line);
539 imstr.Append(line);
540 imstr.Append('\n');
541 }
542
543 // Send as instant message in case user not online.
544 // Code modelled from llInstantMessage().
545 IMessageTransferModule transferModule = m_Engine.World.RequestModuleInterface<IMessageTransferModule>();
546 if(transferModule != null)
547 {
548 UUID friendTransactionID = UUID.Random();
549 GridInstantMessage gim = new GridInstantMessage();
550 gim.fromAgentID = new Guid(m_Part.UUID.ToString());
551 gim.toAgentID = new Guid(m_Part.OwnerID.ToString());
552 gim.imSessionID = new Guid(friendTransactionID.ToString());
553 gim.timestamp = (uint)Util.UnixTimeSinceEpoch();
554 gim.message = imstr.ToString();
555 gim.dialog = (byte)19; // messgage from script
556 gim.fromGroup = false;
557 gim.offline = (byte)0;
558 gim.ParentEstateID = 0;
559 gim.Position = pos;
560 gim.RegionID = m_Engine.World.RegionInfo.RegionID.Guid;
561 gim.binaryBucket = Util.StringToBytes256(
562 "{0}/{1}/{2}/{3}",
563 m_Engine.World.RegionInfo.RegionName,
564 (int)Math.Floor(pos.X),
565 (int)Math.Floor(pos.Y),
566 (int)Math.Floor(pos.Z));
567 transferModule.SendInstantMessage(gim, delegate (bool success)
568 {
569 });
570 } 582 }
571 583
572 // Say script is sleeping for a very long time. 584 // Say script is sleeping for a very long time.
573 // Reset() is able to cancel this sleeping. 585 // Reset() is able to cancel this sleeping.
574 m_SleepUntil = DateTime.MaxValue; 586 m_SleepUntil = DateTime.MaxValue;
575 } 587 }
576 588