How to use the js2py.base.JsToPyException function in Js2Py

To help you get started, we’ve selected a few Js2Py examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github a4k-openproject / script.module.openscrapers / lib / openscrapers / modules / js2py / translators / pyjsparser.py View on Github external
def createError(self, line, pos, description):
        self.log_err_case()
        from js2py.base import ERRORS, Js, JsToPyException
        error = ERRORS['SyntaxError']('Line ' + unicode(line) + ': ' + unicode(description))
        error.put('index',  Js(pos))
        error.put('lineNumber', Js(line))
        error.put('column', Js(pos - (self.lineStart if self.scanning else self.lastLineStart) + 1))
        error.put('description',  Js(description))
        return JsToPyException(error)
github thaitni / xbmc.repo.xshare / plugin.video.xshare / resources / lib / js2py / translators / pyjsparser / parser.py View on Github external
def createError(self, line, pos, description):
        if ENABLE_JS2PY_ERRORS:
            self.log_err_case()
            try:
                from js2py.base import ERRORS, Js, JsToPyException
            except:
                raise Exception("ENABLE_JS2PY_ERRORS was set to True, but Js2Py was not found!")
            error = ERRORS['SyntaxError']('Line ' + unicode(line) + ': ' + unicode(description))
            error.put('index', Js(pos))
            error.put('lineNumber', Js(line))
            error.put('column', Js(pos - (self.lineStart if self.scanning else self.lastLineStart) + 1))
            error.put('description', Js(description))
            return JsToPyException(error)
        else:
            return JsSyntaxError('Line ' + unicode(line) + ': ' + unicode(description))
github odoo / odoo / doc / _extensions / pyjsparser / parser.py View on Github external
def createError(self, line, pos, description):
        global ENABLE_PYIMPORT
        if ENABLE_JS2PY_ERRORS:
            old_pyimport = ENABLE_PYIMPORT  # ENABLE_PYIMPORT will be affected by js2py import
            self.log_err_case()
            try:
                from js2py.base import ERRORS, Js, JsToPyException
            except:
                raise Exception("ENABLE_JS2PY_ERRORS was set to True, but Js2Py was not found!")
            ENABLE_PYIMPORT = old_pyimport
            error = ERRORS['SyntaxError']('Line ' + unicode(line) + ': ' + unicode(description))
            error.put('index', Js(pos))
            error.put('lineNumber', Js(line))
            error.put('column', Js(pos - (self.lineStart if self.scanning else self.lastLineStart) + 1))
            error.put('description', Js(description))
            return JsToPyException(error)
        else:
            return JsSyntaxError('Line ' + unicode(line) + ': ' + unicode(description))
github DxCx / plugin.video.9anime / resources / lib / ui / pyjsparser / parser.py View on Github external
def createError(self, line, pos, description):
        global ENABLE_PYIMPORT
        if ENABLE_JS2PY_ERRORS:
            old_pyimport = ENABLE_PYIMPORT  # ENABLE_PYIMPORT will be affected by js2py import
            self.log_err_case()
            try:
                from js2py.base import ERRORS, Js, JsToPyException
            except:
                raise Exception("ENABLE_JS2PY_ERRORS was set to True, but Js2Py was not found!")
            ENABLE_PYIMPORT = old_pyimport
            error = ERRORS['SyntaxError']('Line ' + unicode(line) + ': ' + unicode(description))
            error.put('index', Js(pos))
            error.put('lineNumber', Js(line))
            error.put('column', Js(pos - (self.lineStart if self.scanning else self.lastLineStart) + 1))
            error.put('description', Js(description))
            return JsToPyException(error)
        else:
            return JsSyntaxError('Line ' + unicode(line) + ': ' + unicode(description))
github I-A-C / script.module.lambdascrapers / lib / lambdascrapers / modules / js2py / translators / pyjsparser.py View on Github external
def createError(self, line, pos, description):
        self.log_err_case()
        from js2py.base import ERRORS, Js, JsToPyException
        error = ERRORS['SyntaxError']('Line ' + unicode(line) + ': ' + unicode(description))
        error.put('index',  Js(pos))
        error.put('lineNumber', Js(line))
        error.put('column', Js(pos - (self.lineStart if self.scanning else self.lastLineStart) + 1))
        error.put('description',  Js(description))
        return JsToPyException(error)
github PiotrDabkowski / Js2Py / js2py / translators / pyjsparser.py View on Github external
def createError(self, line, pos, description):
        self.log_err_case()
        from js2py.base import ERRORS, Js, JsToPyException
        error = ERRORS['SyntaxError']('Line ' + unicode(line) + ': ' + unicode(description))
        error.put('index',  Js(pos))
        error.put('lineNumber', Js(line))
        error.put('column', Js(pos - (self.lineStart if self.scanning else self.lastLineStart) + 1))
        error.put('description',  Js(description))
        return JsToPyException(error)