Skip to content
This repository has been archived by the owner on May 30, 2023. It is now read-only.

console.error messages caught by onConsoleMessage rather than onError #15166

Closed
jgor opened this issue Oct 19, 2017 · 1 comment
Closed

console.error messages caught by onConsoleMessage rather than onError #15166

jgor opened this issue Oct 19, 2017 · 1 comment
Labels

Comments

@jgor
Copy link

jgor commented Oct 19, 2017

The snippet below behaves differently under phantomjs v2.1.1 in the Ubuntu / Debian repositories vs downloading the binary directly from the website and I'm not sure why. Observed on Ubuntu 17.04 and Debian 9.2.1.

Expectation: error messages on the page are caught by onError handler
Reality: error messages are caught by onConsoleMessage instead

Steps to reproduce:

  1. $ apt install phantomjs
  2. download phantomjs binary from http://phantomjs.org
  3. run test.js with both versions and get different outputs

Example:

jgor@ubuntu:~$ cat test.js
var page = require('webpage').create();
page.onConsoleMessage = function(msg) { console.log('Log: ' + msg); }
page.onError = function(msg) { console.log('Error: ' + msg); }
page.open("about:blank", function() {
        page.evaluate(function() {
            console.log('log message');
            console.error('error message');
        });
        phantom.exit();
});
jgor@ubuntu:~$ /usr/bin/phantomjs test.js
Log: log message
Log: error message

jgor@ubuntu:~$ phantomjs-2.1.1-linux-x86_64/bin/phantomjs test.js
Log: log message
Error: error message
jgor@ubuntu:~$ /usr/bin/phantomjs -v
2.1.1

jgor@ubuntu:~$ phantomjs-2.1.1-linux-x86_64/bin/phantomjs -v
2.1.1
@stale stale bot added the stale label Dec 26, 2019
@stale
Copy link

stale bot commented Dec 29, 2019

Due to our very limited maintenance capacity, we need to prioritize our development focus on other tasks. Therefore, this issue will be automatically closed (see #15395 for more details). In the future, if we see the need to attend to this issue again, then it will be reopened. Thank you for your contribution!

@stale stale bot closed this as completed Dec 29, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

1 participant