This is an old question, but still a problem (I have run into this recently). The OP probably used an older version.
A few things to check ...
1) The API for console.log has changed between phantoms 2.1.1 and 2.5.0. In 2.5.0 console.log only the first argument is printed (in 2.1.1 it will print everything).
To be safe, first create a string and register it as the only argument to make sure that this is not just a logging problem. those. console.log(concatenatedString) not console.log(var1, var2, var3,...)
Use JSON.stringify(object) if you want to combine your objects and arrays.
2) In my experience, phantomjs is not consistent with how it fixes errors in the context of the page.
For example, if catchblock does console.log('message', error) on the javascript page, the phantomjs page.onConsoleMessage page.onConsoleMessage will get a line for the message and the string "[object Object]" ... so any error data contained inside this object gets lost between page context and phantomjs.
( console.error may have different behavior than console.log , but I have not tested it.)
3) page.onError is currently broken into 2.5.0 phantoms. It is never called, instead errors are displayed in page.onConsoleMessage , but they skip the error object (see # 2).
Use phantomjs 2.1.1 if you really need to know if there is an error on the page.
See the error below for reproducing code that illustrates the differences between 2.1.1 and 2.5.0 when it comes to page.onError , page.onResourceError and page.onConsoleMessage .
https://github.com/ariya/phantomjs/issues/14776