Improve plugin error handling

This patch improves plugin error handling:

1. Use dlerror to report error whenerve possible.
2. Report plugin error code on error.
3. Only issue cleanup error during cleanup.
8 files changed