Fix for issue where functions wrapped as promises were being treated as a .then() error callback.