SHARE
TWEET

Untitled

a guest Mar 20th, 2019 55 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.         <script type="text/javascript">
  2. (function(){
  3.   function normalizeError(err) {
  4.     var errorInfo = err.error || {};
  5.     var getConfigProp = function(propName, defaultValueIfNotTruthy) {
  6.       var propValue = window._sharedData && window._sharedData[propName];
  7.       return propValue ? propValue : defaultValueIfNotTruthy;
  8.     };
  9.     return {
  10.       line: err.line || errorInfo.message || 0,
  11.       column: err.column || 0,
  12.       name: 'InitError',
  13.       message: err.message || errorInfo.message || '',
  14.       script: errorInfo.script || '',
  15.       stack: errorInfo.stackTrace || errorInfo.stack || '',
  16.       timestamp: Date.now(),
  17.       ref: window.location.href,
  18.       deployment_stage: getConfigProp('deployment_stage', ''),
  19.       is_canary: getConfigProp('is_canary', false),
  20.       rollout_hash: getConfigProp('rollout_hash', ''),
  21.       is_prerelease: window.__PRERELEASE__ || false,
  22.       bundle_variant: getConfigProp('bundle_variant', null),
  23.       request_url: err.url || window.location.href,
  24.       response_status_code: errorInfo.statusCode || 0
  25.     }
  26.   }
  27.   window.addEventListener('load', function(){
  28.     if (window.__bufferedErrors && window.__bufferedErrors.length) {
  29.       if (window.caches && window.caches.keys && window.caches.delete) {
  30.         window.caches.keys().then(function(keys) {
  31.           keys.forEach(function(key) {
  32.             window.caches.delete(key)
  33.           })
  34.         })
  35.       }
  36.       window.__bufferedErrors.map(function(error) {
  37.         return normalizeError(error)
  38.       }).forEach(function(normalizedError) {
  39.         var request = new XMLHttpRequest();
  40.         request.open('POST', '/client_error/', true);
  41.         request.setRequestHeader('Content-Type', 'application/json; charset=utf-8');
  42.         request.send(JSON.stringify(normalizedError));
  43.       })
  44.     }
  45.   })
  46. }());
  47. </script>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top