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

confusing error message [wg data handling error: wrong field number given to wg_get_field #] #34

Closed
aleksandergabriel opened this issue Jun 6, 2018 · 4 comments

Comments

@aleksandergabriel
Copy link

I started to experience some error outputs regarding wg_get_field function. Error message reads like: wg data handling error: wrong field number given to wg_get_field 5, where number changes between 4, 5 and 6 as far as I can tell.
I assumed I was passing wrong field position integer to wg_get_field function, but after some line by line search with debugger I realized that parameters given to wg_get_field are correct and filed number is not connected to number in error message. Also after decoding field I get correct result.
Is number connected with some error code, or is there something else wrong that I am missing at the moment?

@aleksandergabriel aleksandergabriel changed the title wg data handling error: wrong field number given to wg_get_field 5 confusing error message [wg data handling error: wrong field number given to wg_get_field #] Jun 6, 2018
@priitj
Copy link
Owner

priitj commented Jun 6, 2018

The number in the error message is the field number. In case of that error, the returned value should be WG_ILLEGAL which does not decode to anything.

I can look into it if you're sure that you are passing the correct parameters. But I would need a reproducible, short example from you.

@aleksandergabriel
Copy link
Author

If I presume that error is printed out right after the call I am as sure as possible that position number passed to function is not the same as number in error. I will try to create small example where error would be reproduced and send it to you as soon as possible.

@aleksandergabriel
Copy link
Author

aleksandergabriel commented Jun 7, 2018

Unfortunately so far I was unable to reproduce error with any example I wrote. Therefore I am back at debugging full code and trying to catch exact line where error is printed out. So if I understand correctly if wrong filednumber if given to wg_get_field function returns WG_ILLEGAL and if that is passed to wg_decode_<> it would produce error or would it return some error value?

@priitj
Copy link
Owner

priitj commented Jun 7, 2018

I would recommend checking if wg_get_field() returns WG_ILLEGAL.

I know that the tutorial and maybe some other places contain lazy code where that check is not made but this is the most universal and safe way.

@priitj priitj closed this as completed Jul 11, 2018
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

No branches or pull requests

2 participants