What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » [split] show error toast instead of in debug window

[split] show error toast instead of in debug window
Author: Message:
whiz
Senior Member
****


Posts: 568
Reputation: 8
– / – / Flag
Joined: Nov 2008
O.P. RE: [Release] Fake media 1.60
Yes.  Here's the full Debugger object:
Spoiler:
Javascript code:
var Debugger = {};
 
Debugger.Start = new Date();
Debugger.Data = [];
 
Debugger.Trace = function(Text)
{
    if (Messenger.MyStatus > 1)
    {
        try
        {
            if (Registry.Read("Options\\ChkDebug"))
            {
                Debug.Trace(Text);
                Debugger.Data.push(Text);
            }
        }
        catch (error)
        {
            Debug.Trace(Text);
            Debugger.Data.push(Text);
        }
    }
    else
    {
        Debug.Trace(Text);
        Debugger.Data.push(Text);
    }
}
 
Debugger.Call = function(Function, Parameters)
{
    var Notif = Function.substr(Function.length - 19, Function.length);
    if (Notif !== "MessageNotification" || (Notif === "MessageNotification" && Registry.Read("Options\\ChkDebugNotif")))
    {
        Debugger.Trace("=================================================================");
        Debugger.Trace("** Event called: " + Function + " **");
        Debugger.Trace("Call time: " + new Date());
        Debugger.Trace("-----------------------------------------------------------------");
        var Count = 0;
        for (var Parameter in Parameters)
        {
            Debugger.Trace("|| " + Parameter + ": " + Parameters[Parameter]);
            Count++;
        }
        if (Count === 0)
        {
            Debugger.Trace("(no attached parameters)");
        }
        Debugger.Trace("=================================================================");
    }
}
 
Debugger.Catch = function(Function, Error)
{
    Debugger.Trace("/////////////////////////////////////////////////////////////////");
    Debugger.Trace("** Error in: " + Function + " **");
    Debugger.Trace("Description: " + Error.description + " (" + Error.code + ")");
    Debugger.Trace("Error time: " + new Date());
    Debugger.Trace("/////////////////////////////////////////////////////////////////");
}
 
Debugger.Save = function(Path)
{
    var TextFile = FSO.CreateTextFile(Path, 2);
    TextFile.WriteLine("");
    TextFile.WriteLine("=================================================================");
    TextFile.WriteLine("**************** Interface Writer: Debugging Log ****************");
    TextFile.WriteLine("-----------------------------------------------------------------");
    TextFile.WriteLine("Start time: " + Debugger.Start);
    TextFile.WriteLine("=================================================================");
    TextFile.WriteLine("");
    for (var X in Debugger.Data)
    {
        TextFile.WriteLine(Debugger.Data[X]);
    }
    TextFile.WriteLine("");
    TextFile.WriteLine("=================================================================");
    TextFile.WriteLine("End time: " + new Date());
    TextFile.WriteLine("=================================================================");
    TextFile.Close();
}


Edit: it works if the Debugger::Catch function is specified at the start of the initialization function.
Javascript code:
function OnEvent_Initialize(MessengerStart)
{
    Debugger.Catch = function(Function, Error)
    {
        Debugger.Trace("/////////////////////////////////////////////////////////////////");
        Debugger.Trace("** Error in: " + Function + " **");
        Debugger.Trace("Description: " + Error.description + " (" + Error.number + ")");
        Debugger.Trace("Error time: " + new Date());
        Debugger.Trace("/////////////////////////////////////////////////////////////////");
    }
   
    try
    {
        Debugger.Call("Initialize", {"MessengerStart" : MessengerStart});
        // ...
        foo.bar(); // invalid function
    }
    catch (error)
    {
        Debugger.Catch("Initialize", error);
    }
}
       

code:
From the Plus! Script Debug...
/////////////////////////////////////////////////////////////////
** Error in: Initialize **
Description: 'foo' is undefined (-2146823279)
Error time: Thu Jun 10 20:05:41 UTC+0100 2010
/////////////////////////////////////////////////////////////////

This post was edited on 06-10-2010 at 07:09 PM by whiz.
06-10-2010 06:58 PM
Profile E-Mail PM Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
RE: [Release] Fake media 1.60 - by whiz on 06-09-2010 at 04:29 PM
RE: [split] show error toast instead of in debug window - by SmokingCookie on 06-11-2010 at 04:35 PM
RE: [split] show error toast instead of in debug window - by whiz on 06-11-2010 at 07:19 PM
RE: [split] show error toast instead of in debug window - by Matti on 06-12-2010 at 07:25 AM
RE: [split] show error toast instead of in debug window - by whiz on 06-12-2010 at 11:30 AM
RE: [split] show error toast instead of in debug window - by SmokingCookie on 06-12-2010 at 05:14 PM
RE: [split] show error toast instead of in debug window - by whiz on 06-13-2010 at 10:14 AM
RE: [split] show error toast instead of in debug window - by SmokingCookie on 06-13-2010 at 10:28 AM
RE: [split] show error toast instead of in debug window - by whiz on 06-13-2010 at 01:12 PM
RE: [Release] Fake media 1.60 - by SmokingCookie on 06-09-2010 at 04:41 PM
RE: [Release] Fake media 1.60 - by whiz on 06-09-2010 at 05:20 PM
RE: [Release] Fake media 1.60 - by SmokingCookie on 06-09-2010 at 05:27 PM
RE: [Release] Fake media 1.60 - by CookieRevised on 06-10-2010 at 11:26 AM
RE: [Release] Fake media 1.60 - by whiz on 06-10-2010 at 11:30 AM
RE: [Release] Fake media 1.60 - by Matti on 06-10-2010 at 12:47 PM
RE: [Release] Fake media 1.60 - by whiz on 06-10-2010 at 06:36 PM
RE: [Release] Fake media 1.60 - by SmokingCookie on 06-10-2010 at 06:41 PM
RE: [Release] Fake media 1.60 - by whiz on 06-10-2010 at 06:58 PM


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On