Django ``window.onerror`` Report
Project description
Django window.onerror Report
Installation
pip install django-onerror
Urls.py
urlpatterns = [ url(r'^e/', include('django_onerror.urls', namespace='django_onerror')), ]
or:
urlpatterns = [ url(r'^report', err_views.err_report, name='err_report'), ]
Settings.py
INSTALLED_APPS = ( ... 'django_onerror', ... )
FrontEnd
<script> window.onerror = function(errorMessage, scriptURI, lineNo, columnNo, error) { if (['Uncaught ReferenceError: WeixinJSBridge is not defined', 'ResizeObserver loop limit exceeded'].indexOf(errorMessage) >= 0) { return } // 构建错误对象 var errorObj = { href: window.location.href, ua: window.navigator.userAgent, lineNo: lineNo || 0, columnNo: columnNo || 0, scriptURI: scriptURI || null, errorMessage: errorMessage || null, stack: error && error.stack ? error.stack : null }; // 构建Http请求 if (XMLHttpRequest) { var xhr = new XMLHttpRequest(); xhr.open('post', '/e/report', true); xhr.setRequestHeader('Content-Type', 'application/json'); // 设置请求头 xhr.send(JSON.stringify(errorObj)); // 发送参数 } } </script>
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
django-onerror-1.1.0.tar.gz
(4.0 kB
view details)
Built Distributions
django_onerror-1.1.0-py3.11.egg
(14.7 kB
view details)
File details
Details for the file django-onerror-1.1.0.tar.gz
.
File metadata
- Download URL: django-onerror-1.1.0.tar.gz
- Upload date:
- Size: 4.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/18.5 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/2.7.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c9606dc2d0ea8844806b89c20dad563e3c144aa18b735bf03b0c099d15ffdb89 |
|
MD5 | 629c8e83123672a37ac16d8c8cfaf44e |
|
BLAKE2b-256 | 9c05d318f3951cf2a9de3a53450453b45bc925bf26e5629ed14816fe3136f637 |
Provenance
File details
Details for the file django_onerror-1.1.0-py3.11.egg
.
File metadata
- Download URL: django_onerror-1.1.0-py3.11.egg
- Upload date:
- Size: 14.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5ad32126435fdcf7e5a1cf8b99bdbaa32faffd8321699ec291845c866b4376c7 |
|
MD5 | 88c44a5482033545cfad83d42f3f16a9 |
|
BLAKE2b-256 | 289d4f4515f2f7ded6f52eaca2b35e77fb95cd0511cfd2d57081280fa7a73148 |
Provenance
File details
Details for the file django_onerror-1.1.0-py2.py3-none-any.whl
.
File metadata
- Download URL: django_onerror-1.1.0-py2.py3-none-any.whl
- Upload date:
- Size: 6.5 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/18.5 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/2.7.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e407a6462cecd6325b69eeca812269abee9f0de2b1909fbe845b09e5170de285 |
|
MD5 | 593d0f8b8634f2970f4033fdb32e138c |
|
BLAKE2b-256 | 8ab167d0ae8e49573766cebe52ab925e0b20a0a932a2701cbf4ca51145c99a98 |