Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 844142
Collapse All | Expand All

(-)a/dash/dash-renderer/src/components/error/FrontEnd/FrontEndError.react.js (-1 / +1 lines)
Lines 110-116 function UnconnectedErrorContent({error, base}) { Link Here
110
            )}
110
            )}
111
            {/* Backend Error */}
111
            {/* Backend Error */}
112
            {typeof error.html !== 'string' ? null : error.html.indexOf(
112
            {typeof error.html !== 'string' ? null : error.html.indexOf(
113
                  '<!DOCTYPE HTML'
113
                  '<!DOCTYPE'
114
              ) === 0 ? (
114
              ) === 0 ? (
115
                <div className='dash-be-error__st'>
115
                <div className='dash-be-error__st'>
116
                    <div className='dash-backend-error'>
116
                    <div className='dash-backend-error'>
(-)a/dash/dash.py (-10 / +33 lines)
Lines 19-25 from future.moves.urllib.parse import urlparse Link Here
19
19
20
import flask
20
import flask
21
from flask_compress import Compress
21
from flask_compress import Compress
22
from werkzeug.debug.tbtools import get_current_traceback
22
23
from werkzeug.debug import tbtools
24
from werkzeug.security import gen_salt
25
23
from pkg_resources import get_distribution, parse_version
26
from pkg_resources import get_distribution, parse_version
24
27
25
import plotly
28
import plotly
Lines 91-96 _re_index_scripts_id = 'src="[^"]*dash[-_]renderer[^"]*"', "dash-renderer" Link Here
91
_re_renderer_scripts_id = 'id="_dash-renderer', "new DashRenderer"
94
_re_renderer_scripts_id = 'id="_dash-renderer', "new DashRenderer"
92
95
93
96
97
def _get_traceback(secret, error):
98
    def _get_skip(text):
99
        skip = 0
100
        for i, line in enumerate(text.splitlines()):
101
            if "%% callback invoked %%" in line:
102
                skip = int((i + 1) / 2)
103
                break
104
        return skip
105
106
    # werkzeug<2.1.0
107
    if hasattr(tbtools, "get_current_traceback"):
108
        tb = tbtools.get_current_traceback()
109
        skip = _get_skip(tb.plaintext)
110
        return tbtools.get_current_traceback(skip=skip).render_full()
111
112
    tb = tbtools.DebugTraceback(error)  # pylint: disable=no-member
113
    skip = _get_skip(tb.render_traceback_text())
114
115
    # pylint: disable=no-member
116
    return tbtools.DebugTraceback(error, skip=skip).render_debugger_html(
117
        True, secret, True
118
    )
119
120
94
class _NoUpdate(object):
121
class _NoUpdate(object):
95
    # pylint: disable=too-few-public-methods
122
    # pylint: disable=too-few-public-methods
96
    pass
123
    pass
Lines 1463-1481 class Dash(object): Link Here
1463
1490
1464
        if debug and dev_tools.prune_errors:
1491
        if debug and dev_tools.prune_errors:
1465
1492
1493
            secret = gen_salt(20)
1494
1466
            @self.server.errorhandler(Exception)
1495
            @self.server.errorhandler(Exception)
1467
            def _wrap_errors(_):
1496
            def _wrap_errors(error):
1468
                # find the callback invocation, if the error is from a callback
1497
                # find the callback invocation, if the error is from a callback
1469
                # and skip the traceback up to that point
1498
                # and skip the traceback up to that point
1470
                # if the error didn't come from inside a callback, we won't
1499
                # if the error didn't come from inside a callback, we won't
1471
                # skip anything.
1500
                # skip anything.
1472
                tb = get_current_traceback()
1501
                tb = _get_traceback(secret, error)
1473
                skip = 0
1502
                return tb, 500
1474
                for i, line in enumerate(tb.plaintext.splitlines()):
1475
                    if "%% callback invoked %%" in line:
1476
                        skip = int((i + 1) / 2)
1477
                        break
1478
                return get_current_traceback(skip=skip).render_full(), 500
1479
1503
1480
        if debug and dev_tools.ui:
1504
        if debug and dev_tools.ui:
1481
1505
1482
- 

Return to bug 844142