pass in optional arguments for error_message, error_info and error_code. Fallback to global error variable to maintain backwords compatibility