when handle error arguments test if last arg is function for returning correct callback