Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(client): Only create the funky object if message is not a string #3298

Merged
merged 1 commit into from Apr 15, 2019

Conversation

johnjbarton
Copy link
Contributor

Fixes #3296

@johnjbarton johnjbarton requested a review from kyliau April 12, 2019 20:10
client/karma.js Outdated
// create an object with the string representation of the message to ensure all its content is properly
// transferred to the console log
message = {message: message, str: message.toString()}
if (typeof message !== 'string') {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the logic above this line assumes that message is a string, so perhaps it's better to do the following:

    var message = messageOrEvent
    if (typeof message === "string") {
        var location = getLocation(source, lineno, colno)
        if (location !== '') {
          message += '\nat ' + location
        }
        if (error) {
          message += '\n\n' + error.stack
        }
     }
     else {
      // create an object with the string representation of the message to ensure all its content is properly
      // transferred to the console log
      message = {message: message, str: message.toString()}
    }

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please take another look (the appveyor builds passed but failed to update github)

@johnjbarton johnjbarton merged commit ce6825f into karma-runner:master Apr 15, 2019
@johnjbarton johnjbarton deleted the message-str-errors branch December 23, 2020 20:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Difficulty debugging errors, stack traces missing and/or poor formatting
2 participants