WB* macros uses __func__ instead of __LINE__

The lineno is unstable. source code changes frequently.
function name is rather stable.

plus:
- fix error checks.