Node Defender Console doesn't show console.error() messages - javascript

https://node-defender.herokuapp.com/
Is there a way to get meaningful feedback? I'm getting an error that doesn't make sense and I want to check that the function I made is actually returning a mob object instead of "undefined", which it shouldn't be.
Console.error isn't showing up in the console on the right when I run my code. Is there another way to get meaningful feedback from my code so that I can debug it?

It's probably easier/quicker to do the console.log or console.error and look at the actual browser console instead of relying on the in-game console.

Related

How to hide console error messages in Angular JS?

How to hide console error messages in Angular JS?
My web apps is works, no bug!!!! but it has a lot of error message in console.
thanks
Update: I just fix my bug, but this bug can't fix.............anyidea...THX
It looks like most of the errors you show in your screenshot stem from the same issue - namely, attempting to call .length on an object that does not exist.
If you expect the object to not exist sometimes, then you should fix the source of that error with something like:
if (object.length) { ... do something with .length property ... }
Errors should not be ignored! They're our only window into understanding when our programs are not behaving as we intend.

Postman format console log output

I'm using the open source version of Postman
I have a console log output in the Pre-Request script for each of my API calls, which just outputs the title of the call.
Is there a way of formatting the console log output in postman to make it stand out in the console log? I want to either enlarge or bold the text or make it a different colour so it is clear in the console log.
It doesn't seem to be possible, though console output gets some different colors for error codes or strings.
javascript string formatting doesn't work either. You should output some visible strings like you would do in normal consoles like:
console.log("******************************");
console.log("********* MY TEST ********");
console.log("******************************");
sorry, can't see a better way
Alexandre
In node.js there is by using escape sequence:
console.log('\x1b[36m%s\x1b[34m%s\x1b[0m', 'I am cyan','i am blue');
So you should be able to if running Newman as a library within Node. And there is a way to provide colors for browser based console.log; however, not in the desktop application. I too would much appreciate some simple formatting to help my log events to stand out from the rest. But I have resorted to using something similar to a-joly's response above
console.log("******************************");
console.log("********* MY TEST ********");
console.log("******************************");
to help with this issue.
There are other formatting styles capable within Node's console.log as well, they can be viewed here:

Debugging Ember JS -- Identifying line in code that causes an error

So I'm getting the following error:
Uncaught Error: Assertion Failed: The key provided to get must be a string, you passed undefined
Should be easy enough to fix, if there was any indication of the line in my code that causes that error.
Using the chrome console, I click on ember.debug.js:6254 next to the error, which just shows me the ember code that throws the error. I can expand the error, but I just get a bunch of functions that can't be clicked on and no indication where they come from.
Can someone please help me figure out how to identify the line in my Ember code that is causing the error.
I've gotten this error before. It happens when you call get() in any of its forms (Ember.get() or this.get() or get(this)) without a string as the name of the property you want to retrieve.
You should be able to find the source of the error by auditing your application for wherever you call get() and making sure you pass the property name as a string. E.g., Ember.get('model.someProp') or this.get('someProp') or get(this, 'someProp').
This should be a comment but I can't, so here goes:
Iam new to Ember and have been spending quite a long time debugging. Remember that long stack of function calls that chrome's console shows.
Look for anything other than ember.debug.js...especially those marked (anonymous function) and files with names vendor.js or app-name.js
Usually in software development when debugging your best friends are going to be console.log() or alert() (in the case of JavaScript). Usually you have to figure out if your getting what ever is that you passing to your function by consolelog everything until you find your bug. Ember sometimes will not tell you what is exactly the error because does not know where exactly is coming from.
...computers are annoying but we love them....
here are some articles from Mozilla developer and Google on how to debug JavaScript.
I had a NULL value in my database which I wasn't accounting for in my app. In my case, it shouldn't have been NULL in the first place, so after giving the record a value in my database the problem disappeared.
I agree the error message is not very helpful.

JS: Output the content of the console log

I'm using the console log to record any errors in a HTML/JS web application. Is there a way to output the contents of the console log?
For instance, lets say we log "Hello world" console.log('Hello world');
Is there a way I can get back what's been logged at a later time? Something like:
alert(console.log());
Thanks in advance!
The console provides a log method which does nothing other than write your message into the console output in real time. You can see this in the developer tools of many browsers.
There is no way to ask the native console for a list of things logged. You would need to write something yourself, perhaps augmenting the native console.
No, that is not possible.
Check this link for the full Console API Reference for Google Chrome. Other browsers have their own console API, but they're generally the same.

Showing JavaScript exception message in Chrome dev tools

I'm using Chrome development tools to debug my JavaScript. When I tell Chrome "Not to pause on exceptions" and load my script, I get an intelligible description of what went wrong with the correct line highlighted:
var back_buffer = goog.dom.getElement('back_buffer').getContext('2d');
--> "Uncaught TypeError: Cannot call method 'getContext' of null"
OK, it makes sense: there's a typo in the name of my canvas element so 'getElement' returns null.
Now on to my question: when I tell Chrome to 'pause on uncaught exceptions', it still correctly highlights the offending line in my script, but now the nice, intelligible error descriptions is gone! How come? Even in debug mode I'd like to see the error message because it's very helpful. I poked around but couldn't find it anywhere.
Anybody could help here?
There does not appear to be good way to do this currently. This is the closest you can get:
The error is not showing because the execution of that script is paused just before it goes into the exception.
It's pausing right before the error so you can debug some things in the console.
What i tend to do in the situation you talk about, and the scope variables are not giving any more info, is add some watch expressions or execute some commands in the console.
In your back_buffer case you could for instance add a watch expression like this goog.dom.getElement('back_buffer') so you could see what it resolves to. If that expression causes an error you will see the error message there like you would after the script error occurred.
It might not be completely obvious to some people that when script execution is halted the execution context is the same as the execution context of the script at the time it paused, so all local variables are accessible in the console to console.log() or console.dir() or anything.
When you have pretty print set to on there will be not that much going on on that one line it paused at so mostly you shouldn't have to search for long to get an idea of what's causing the error and why.
Hope it helps,
PM5544.
You should be able see the same text in a red bubble message just under the offending source line once it executes.
Just do one more 'Step' and the red bubble will appear. This is logical as it pauses before the error/bubble behavior happens.
What if you catch the exception and send it to the log:
try
{
var back_buffer = goog.dom.getElement('back_buffer').getContext('2d');
}
catch(err)
{
console.log(err);
}
Once in the console you can examine the object in more detail.

Categories