Python struct.errors() Examples

The following are 10 code examples for showing how to use struct.errors(). These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example.

You may check out the related API usage on the sidebar.

You may also want to check out all available functions/classes of the module struct , or try the search function .

Example 1
Project: ironpython2   Author: IronLanguages   File: xdrlib.py    License: Apache License 2.0 5 votes vote down vote up
def raise_conversion_error(function):
    """ Wrap any raised struct.errors in a ConversionError. """

    @wraps(function)
    def result(self, value):
        try:
            return function(self, value)
        except struct.error as e:
            raise ConversionError(e.args[0])
    return result 
Example 2
Project: oss-ftp   Author: aliyun   File: xdrlib.py    License: MIT License 5 votes vote down vote up
def raise_conversion_error(function):
    """ Wrap any raised struct.errors in a ConversionError. """

    @wraps(function)
    def result(self, value):
        try:
            return function(self, value)
        except struct.error as e:
            raise ConversionError(e.args[0])
    return result 
Example 3
Project: Fluid-Designer   Author: Microvellum   File: xdrlib.py    License: GNU General Public License v3.0 5 votes vote down vote up
def raise_conversion_error(function):
    """ Wrap any raised struct.errors in a ConversionError. """

    @wraps(function)
    def result(self, value):
        try:
            return function(self, value)
        except struct.error as e:
            raise ConversionError(e.args[0]) from None
    return result 
Example 4
Project: Imogen   Author: CedricGuillemet   File: xdrlib.py    License: MIT License 5 votes vote down vote up
def raise_conversion_error(function):
    """ Wrap any raised struct.errors in a ConversionError. """

    @wraps(function)
    def result(self, value):
        try:
            return function(self, value)
        except struct.error as e:
            raise ConversionError(e.args[0]) from None
    return result 
Example 5
Project: ironpython3   Author: IronLanguages   File: xdrlib.py    License: Apache License 2.0 5 votes vote down vote up
def raise_conversion_error(function):
    """ Wrap any raised struct.errors in a ConversionError. """

    @wraps(function)
    def result(self, value):
        try:
            return function(self, value)
        except struct.error as e:
            raise ConversionError(e.args[0]) from None
    return result 
Example 6
Project: Splunking-Crime   Author: nccgroup   File: xdrlib.py    License: GNU Affero General Public License v3.0 5 votes vote down vote up
def raise_conversion_error(function):
    """ Wrap any raised struct.errors in a ConversionError. """

    @wraps(function)
    def result(self, value):
        try:
            return function(self, value)
        except struct.error as e:
            raise ConversionError(e.args[0])
    return result 
Example 7
Project: Project-New-Reign---Nemesis-Main   Author: ShikyoKira   File: xdrlib.py    License: GNU General Public License v3.0 5 votes vote down vote up
def raise_conversion_error(function):
    """ Wrap any raised struct.errors in a ConversionError. """

    @wraps(function)
    def result(self, value):
        try:
            return function(self, value)
        except struct.error as e:
            raise ConversionError(e.args[0]) from None
    return result 
Example 8
Project: PokemonGo-DesktopMap   Author: mchristopher   File: xdrlib.py    License: MIT License 5 votes vote down vote up
def raise_conversion_error(function):
    """ Wrap any raised struct.errors in a ConversionError. """

    @wraps(function)
    def result(self, value):
        try:
            return function(self, value)
        except struct.error as e:
            raise ConversionError(e.args[0])
    return result 
Example 9
Project: unity-python   Author: exodrifter   File: xdrlib.py    License: MIT License 5 votes vote down vote up
def raise_conversion_error(function):
    """ Wrap any raised struct.errors in a ConversionError. """

    @wraps(function)
    def result(self, value):
        try:
            return function(self, value)
        except struct.error as e:
            raise ConversionError(e.args[0])
    return result 
Example 10
Project: android_universal   Author: bkerler   File: xdrlib.py    License: MIT License 5 votes vote down vote up
def raise_conversion_error(function):
    """ Wrap any raised struct.errors in a ConversionError. """

    @wraps(function)
    def result(self, value):
        try:
            return function(self, value)
        except struct.error as e:
            raise ConversionError(e.args[0]) from None
    return result