GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(client): Only create the funky object if message is not a string … · karma-runner/karma@ce6825f

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • client
    • karma.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎client/karma.js‎

Copy file name to clipboardExpand all lines: client/karma.js
+14-12Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -145,21 +145,23 @@ function Karma (socket, iframe, opener, navigator, location) {
145145
// error during js file loading (most likely syntax error)
146146
// we are not going to execute at all. `window.onerror` callback.
147147
this.error = function (messageOrEvent, source, lineno, colno, error) {
148-
var message = messageOrEvent
149-
var location = getLocation(source, lineno, colno)
148+
var message
149+
if (typeof messageOrEvent === 'string') {
150+
message = messageOrEvent
150151

151-
if (location !== '') {
152-
message += '\nat ' + location
153-
}
154-
155-
if (error) {
156-
message += '\n\n' + error.stack
152+
var location = getLocation(source, lineno, colno)
153+
if (location !== '') {
154+
message += '\nat ' + location
155+
}
156+
if (error && error.stack) {
157+
message += '\n\n' + error.stack
158+
}
159+
} else {
160+
// create an object with the string representation of the message to
161+
// ensure all its content is properly transferred to the console log
162+
message = {message: messageOrEvent, str: messageOrEvent.toString()}
157163
}
158164

159-
// create an object with the string representation of the message to ensure all its content is properly
160-
// transferred to the console log
161-
message = {message: message, str: message.toString()}
162-
163165
socket.emit('karma_error', message)
164166
this.complete()
165167
return false

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.