pact-foundation / pact-reference

Reference implementations for the pact specifications
https://pact.io
MIT License
91 stars 46 forks source link

chore: update 'could not load pacts' message to 'no pacts found' #312

Closed bethesque closed 10 months ago

bethesque commented 10 months ago

What I'm trying to achieve is to change the message from "Could not load pacts from the pact broker" to "No pacts found matching the given consumer version selectors in pact broker" when there are no pacts returned in the pacts-for-verification response. The current message makes it sound like there was a problem during the actual fetching process.

I don't think this is the right place, because this code seems to be handling an error, rather than dealing with a pacts.length == 0 scenario, but I thought I'd start somewhere!

rholshausen commented 10 months ago

Maybe we should include the selectors that were used in the request?

bethesque commented 10 months ago

Yes, that would be handy. I might need to learn a bit more rust to submit that though! Shall we start with this one and then improve it?

rholshausen commented 10 months ago

It is going to need a refactor, as you mentioned, this code seems to be handling an error, rather than dealing with the source occurrence. I'm happy to take this on.

bethesque commented 10 months ago

Thanks Ron. I'm confused where the message for pacts.length == 0 is coming from though, because I can't find any other instance of that text, and that's definitely the message people are getting when there are no pacts returned. Is there another codebase?

rholshausen commented 10 months ago

pacts.length == 0 is not coming from the Rust code, that must be from the client implementation.