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

Add function to return real error from OPC DA #58

Open
DanielXavierJob opened this issue Dec 17, 2024 · 2 comments
Open

Add function to return real error from OPC DA #58

DanielXavierJob opened this issue Dec 17, 2024 · 2 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@DanielXavierJob
Copy link

Hello! I need to get the real OPC DA connection error, as well as other errors, but in the current logic of the code you just check the error and return a pre-formatted string saying, for example, that the connection failed, and I believe that the return informs if was the problem with the machine or was it with the server, was it between communication and other important factors for debuggin

Ex:

image

@DanielXavierJob
Copy link
Author

I did a test and just added this to the failed connection line of code:
return nil, errors.New(fmt.Sprintf("Connection failed %v", err.Error()))

And the feedback was very good:
image

@konimarti
Copy link
Owner

Yes, that's a good idea. Would you like to submit your changes as a PR?

If so, please create the errors with fmt.Errorf("Connection failed: %w", err) and also update the logger output.

@konimarti konimarti added enhancement New feature or request good first issue Good for newcomers labels Jan 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants