add onError method in order to get the exception