Implementing error handling in pact api