Improved error messages in extension code