annotate src/site.js @ 59:02d8876dc41d

improve change email
author Franklin Schmidt <fschmidt@gmail.com>
date Tue, 29 Nov 2022 18:45:22 -0700
parents 78b2d6995244
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7
0472897e790d add javascript
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
1
0472897e790d add javascript
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
2 window.onerror = function(msg, url, line, col, error) {
0472897e790d add javascript
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
3 if (!url)
0472897e790d add javascript
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
4 return;
0472897e790d add javascript
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
5 let err = msg;
0472897e790d add javascript
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
6 err += '\nurl = ' + url;
0472897e790d add javascript
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
7 if (url != window.location)
0472897e790d add javascript
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
8 err += '\npage = ' + window.location;
0472897e790d add javascript
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
9 err += '\nline = '+line;
0472897e790d add javascript
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
10 if (col)
0472897e790d add javascript
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
11 err += '\ncolumn = ' + col;
0472897e790d add javascript
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
12 if (error && error.stack)
0472897e790d add javascript
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
13 err += '\nstack = ' + error.stack;
0472897e790d add javascript
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
14 ajax( '/error_log.js', 'err='+encodeURIComponent(err) );
0472897e790d add javascript
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
15 };