Changing error handling of marshaling and template rendering