Add onError callback