better error handling around error-prone plugin code