add success and error functions as resource method parameters