Jump to content
iqrf

Calling a user exception defined in the external exceptions.py file

Recommended Posts

Hi,

in demo34 there is an example of using a user Exception

with PythonModule1.Errors.Add do begin
    Name := 'PointError';
    ErrorType := etClass;
  end;

GetModule.RaiseError( 'PointError', 'this is an example of raising an error !' );

Is there any way to use the definitions of exceptions from an external exception.py file and call them with GetModule.RaiseError?

class RequestNadrInvalidError(ValueError):
    """
    Invalid NADR value.

    This error is raised whenever a request object receives
    address that is out of allowed range ([C]: 0, [N]: 1-239).
    """
    pass


class RequestHwpidInvalidError(ValueError):
    """
    Invalid HWPID value.

    This error is raised whenever a request object receives
    HWPID that is out of allowed range (0-65535 / 0x00-0xFF).
    """
    pass


class RequestParameterInvalidValueError(ValueError):
    """
    Invalid request parameter value.

    This error is raised whenever a request object receives
    a parameter with value outside of it's defined domain.
    """
    pass

Thanks

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×