Catching all JavaScript errors/exceptions on Wii/Opera 9
Asked Answered
C

2

8

I am updating a site that I've built for the Nintendo Wii, and am looking for a good way to debug the application. Wii's browser (a version of Opera 9.3) does not have any sort of JavaScript console. I was going to use one of the various remote debug console solutions (such as jsconsole.com), but none of them seem to work. I suspect the reason for this is some sort of unsupported functionality, but I cannot figure out what that is without a console or some sort of error output.

Things I've tried:

  1. window.onerror (Not supported until Opera 11.6)
  2. Overriding the Error.prototype.toString method (works on desktops, not on Wii)
  3. Code that appears to wrap script in try/catch blocks (Exceptions aren't thrown for reference errors and what not. try/catch works, but only for exceptions I throw.)
  4. <body onerror="alert('ERROR!!!')" />
  5. PhoneGap's Remote Debugger / Weinre

Are there any other suggestions for catching errors and unhandled exceptions for an entire page?

Catrinacatriona answered 30/9, 2012 at 19:40 Comment(8)
"(I imagine this isn't working since it will only catch exceptions, and not runtim errors?)" - what do you mean by runtime error? On Chrome it catches everything I could think of except syntax errors.Peabody
@millimoose, Good point, I hadn't thought that through. There isn't a syntax error in the code from jsconsole.com... so I wonder why the try/catch approach doesn't work? I will look into it some more.Catrinacatriona
have you tried PhoneGap's remote debugging script? debug.phonegap.com just include the script tag into your html and check to see if there are errors. You can also use the console tab to interact with your site.Prima
@Tony, I wasn't able to get PhoneGap's debugger to work, but I think it's because some of their scripts aren't loading at the moment. In any case, it looks like they are using Weinre, so I downloaded that and gave it a try from my server... no luck. It works on a desktop, but on the Wii, it never appears as a target.Catrinacatriona
I'm sorry it didn't work out, didn't want to waste your time. On another note, I always thought that developing for iOS devices is difficult because of Apple's wall garden. I think comparing to what you are going through to get your Wii app up and running, developing for iOS devices is pretty much easy.Prima
Out of curiosity, have you tried a simple (though an incredibly tedious method of debugging) using try { // do stuff } catch (err) { document.getElementById('output').textContent = err; }? I assume you have (and, as noted, if you haven't then I can't imagine it would speed up your work-flow, but might help a little...).Correspondence
Does some generic try..catch block (which you would put on separate page to avoid other script interfere) work ever? Or you just can't seem to use try..catch blocks on Wii at all?Actinic
A try/catch block does work, but it seems that exceptions are not being thrown. If I throw my own exception, I can catch it, but things like null reference exceptions aren't thrown.Catrinacatriona
A
1

this link was suggestting lookimng into firebug lite. I don't know how it would fare on the wii browser as I don't own the device.

It's a pity that the engine is too old for supporting draagonfly.

Amagasaki answered 8/10, 2012 at 16:1 Comment(1)
Thanks, Firebug Lite has loaded successfully on the Wii! I don't know if I can get anything to show up in its console, but at least I have a way to poke around a bit and see if I can narrow down the issue.Catrinacatriona
P
1

You could always program in the debugging code yourself, for instance:

try{
    yourFunction();
}catch(e){
    alert('yourFunction failed!');
}
Perambulator answered 2/11, 2012 at 17:2 Comment(1)
This doesn't work, as I have said in my question. I need to catch errors for the whole page, not just a single block. In any case, I've found that the browser isn't actually throwing exceptions, which is why I am unable to catch them.Catrinacatriona

© 2022 - 2024 — McMap. All rights reserved.