Skip to content

How to control the return StatusCode from a UAMethod call on the server #1347

Answered by schroeder-
piperoc asked this question in Q&A
Discussion options

You must be logged in to vote

You have to wrap the error code in ua.StatusCode:

 def func(parent, variant):
    print("func method call with parameters: ", variant.Value)
    ret = False
    if variant.Value == 42:
        return ua.StatusCode(ua.StatusCodes.BadInvalidArgument)
    if variant.Value % 2 == 0:
        ret = True
    return [ua.Variant(ret, ua.VariantType.Boolean)]

Replies: 3 comments 5 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
4 replies
@schroeder-
Comment options

@piperoc
Comment options

@piperoc
Comment options

@piperoc
Comment options

Comment options

You must be logged in to vote
1 reply
@piperoc
Comment options

Answer selected by piperoc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants