[TxMt] Re: HTML output window: How to access JavaScript errors

Hans-Jörg Bibiko bibiko at eva.mpg.de
Thu Sep 25 07:39:36 UTC 2008


On 25.09.2008, at 08:59, Allan Odgaard wrote:

> On 23 Sep 2008, at 22:29, Hans-Jörg Bibiko wrote:
>
>> I have an HTML page running in TM's HTML output window with embedded
>> JavaScript and my JavaScript is not correct, I can invoke 'Inspect
>> Element' to see the error. Fine.
>>
>> But is there a way to access the error message from outside, I mean
>> by a script?
>
> Not by a script. You need that?
Well, if one writes JavaScript applications etc. like with Objective-J  
it is useful to have the chance to have a look at the errors more or  
less automatically, meaning the error message pops up or whatever.
With Obj-J I found a way to redirect all these errors to a file and  
start 'mate theFile'.
Also to wrap all the JS stuff into try catch(e){TextMate.system} works  
fine.


>> If not, would it be possible to redirect the JavaScript error
>> messages to a log file?
>
> I _think_ it already goes to the console.
This is in some sense tricky. Sometimes I see:
25.09.08 09:29:03 TextMate[116] JavaScript Exception: 22:  
ReferenceError: Can't find variable: objj_imp1ort

but also:
25.09.08 09:26:10 TextMate[116] JavaScript Exception: 1208: undefined

whereas the Web Inspector shows:
Can't find variable: CPAWindow


Anyway, thanks for the hints. For Obj-J I found a way.

Best,

--Hans


More information about the textmate mailing list