Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix handling of UaStatusCodeErrors in UaProcessor.process_message #1570

Merged
merged 1 commit into from
Feb 8, 2024

Conversation

FMeinicke
Copy link
Contributor

I noticed that raising a BadOutOfRangeError in a server callback set through Server.subscribe_server_callback resulted in a BadInternalError on the client side (tested with UaExpert) rather than the expected BadOutOfRange. But raising a
ServiceError(ua.StatusCodes.BadOutOfRange) instead would show the the expected BadOutOfRange error in the client.
The reason for this idiosyncrasy was that UaStatusCodeErrors were not explicitly caught. Therefore the "default" except Exception handler would be used which resulted in a
ua.StatusCode(ua.StatusCodes.BadInternalError) to be sent to the client instead of the actual status code of the error that occurred.

This commit changes the behavior such that the status code of UaStatusCodeErrors is respected the same way as it's already done for ServiceErrors so that the client correctly receives the status code of the raised error.

See also #1563 (reply in thread)

I noticed that raising a `BadOutOfRangeError` in a server callback set
through `Server.subscribe_server_callback` resulted in a
*BadInternalError* on the client side (tested with UaExpert) rather than
the expected *BadOutOfRange*. But raising a
`ServiceError(ua.StatusCodes.BadOutOfRange)` instead would show the the
expected *BadOutOfRange* error in the client.
The reason for this idiosyncrasy was that `UaStatusCodeError`s were not
explicitly caught. Therefore the "default" `except Exception` handler
would be used which resulted in a
`ua.StatusCode(ua.StatusCodes.BadInternalError)` to be sent to the
client instead of the actual status code of the error that occurred.

This commit changes the behavior such that the status code of
`UaStatusCodeError`s is respected the same way as it's already done for
`ServiceError`s so that the client correctly receives the status code of
the `raise`d error.

See also FreeOpcUa#1563 (reply in thread)
@oroulet oroulet merged commit 8cf8682 into FreeOpcUa:master Feb 8, 2024
5 checks passed
@FMeinicke FMeinicke deleted the fix-uastatuscodeerror-handling branch February 8, 2024 08:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants