diff --git a/catch-js-errors.js b/catch-js-errors.js index 4866df1921301..4b93badbbd4e2 100644 --- a/catch-js-errors.js +++ b/catch-js-errors.js @@ -31,14 +31,20 @@ params = 'client_id=39911&client_secret=cOaYKdrkgXz8xY7aysv4fU6wL6sK5J8a6ojReEIAPwggsznj4Cb6mW0nffTxtYT8&error='; params += encodeURIComponent( JSON.stringify( savedErrors ) ); - xhr.setRequestHeader( 'Content-length', params.length ); - xhr.setRequestHeader( 'Connection', 'close' ); xhr.send( params ); savedErrors = []; } } + function errorToPlainObject( error ) { + var simpleObject = {}; + Object.getOwnPropertyNames( error ).forEach( function( key ) { + simpleObject[ key ] = error[ key ]; + } ); + return simpleObject; + } + function handleError( error ) { var canSendNow; @@ -52,7 +58,7 @@ // add the message to the pack and reset flush timeout clearTimeout( packTimeout ); - savedErrors.push( error ); + savedErrors.push( errorToPlainObject( error ) ); // if we can send the pack now, let's do it if ( canSendNow ) {