Skip to main content

django-onerror

Django window.onerror Report

Installation

pip install django-onerror

Urls.py

urlpatterns = [
    url(r'^e/', include('django_onerror.urls', namespace='django_onerror')),
]

or

from django.conf.urls import include, url
from django_onerror import views as err_views

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>

Ignore

Metadata

Release files for django-onerror 1.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-onerror 1.1.1
File Size Uploaded Provenance Actions
django-onerror-1.1.1.tar.gz 5.2 kB Without provenance Details for django-onerror-1.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for django-onerror 1.1.1
File Interpreter ABI Platform Actions
django_onerror-1.1.1-py2.py3-none-any.whl Python 3, Python 2 none any Details for django_onerror-1.1.1-py2.py3-none-any.whl

Total release size: 11.9 kB

Release files / django-onerror-1.1.1.tar.gz

Download URL django-onerror-1.1.1.tar.gz
Size 5.2 kB
Tags Source
SHA-256 checksum
How to use checksums
181410f826f2369c7037488a86efdad2f4e8484f7ce8ba7408bcbb6d4df1c87d
BLAKE2b-256 checksum
How to use checksums
836bae98bdc06bf40e78a6f47a83dc35b55bc0df2a3b60cc365dbe497e8f3983
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.1

Release files / django_onerror-1.1.1-py2.py3-none-any.whl

Download URL django_onerror-1.1.1-py2.py3-none-any.whl
Size 6.6 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
7fa722aa1461d300e2bb6ddee8d62066adc92ce3aea7703886fe7024b87e16b8
BLAKE2b-256 checksum
How to use checksums
8bf2e010c58ae59b3b218b270f0e88abd5c24b3aea5c6a15124123805d980003
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.1

Security for django-onerror 1.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page