making error/success handlers promise compatible