Esempio n. 1
0
def jserror(request):
    stack = request.POST.get('stack', None)
    message = request.POST.get('message', None)
    if stack:
        cache_key = ' '.join(map(lambda l: l.strip(), stack.split('\n'))[:3])
    else:
        cache_key = message

    count = ExponentialBackoff.increment(cache_key)
    if not ExponentialBackoff.should_backoff(cache_key):
        notify_js_exception(request,
                            message=message,
                            details={
                                'filename': request.POST.get('filename', None),
                                'line': request.POST.get('line', None),
                                'page': request.POST.get('page', None),
                                'agent':
                                request.META.get('HTTP_USER_AGENT', None),
                                'js_stack': stack,
                                'count': count,
                            })

    return HttpResponse('')
Esempio n. 2
0
def jserror(request):
    stack = request.POST.get('stack', None)
    message = request.POST.get('message', None)
    if stack:
        cache_key = ' '.join(map(lambda l: l.strip(), stack.split('\n'))[:3])
    else:
        cache_key = message

    count = ExponentialBackoff.increment(cache_key)
    if not ExponentialBackoff.should_backoff(cache_key):
        notify_js_exception(
            request,
            message=message,
            details={
                'filename': request.POST.get('filename', None),
                'line': request.POST.get('line', None),
                'page': request.POST.get('page', None),
                'agent': request.META.get('HTTP_USER_AGENT', None),
                'js_stack': stack,
                'count': count,
            }
        )

    return HttpResponse('')