karlwancl / GoogleCloudPrintApi

A .NET wrapper for Google Cloud Print API, based on .NET standard 1.4
MIT License
12 stars 14 forks source link

Issue regarding FetchJobAsync() response. #5

Closed Jezternz closed 7 years ago

Jezternz commented 7 years ago

Sorry to bring up yet another issue, for my purposes I am basically done, and have my project working end-to-end.

This is in no way urgent but would be a good improvement. Basically my problem is that FetchJobAsync() appears to give strange responses, eg:

  1. When I run a FetchJobAsync() against a printer that does not exist I get a generic "No print job available on specified printer." exception.
  2. When I run a FetchJobAsync() against a printer with 0 printjobs queued I get a generic "No print job available on specified printer." exception,
  3. When I run a FetchJobAsync() against a printer with 1 or more printjobs queued I get fetchResponse.Jobs populated with a list of jobs.

I feel like it might be worth modifying these to something like:

  1. Throw exception as it did, but give googles error as Message.
  2. Do not throw exception, instead respond with empty array for fetchResponse.Jobs
  3. Behaves as expected.

Thanks again, Josh

karlwancl commented 7 years ago

Hi J,

Nice to see you have finished your project with this library =)

For the issue, our library actually reflects error code & message directly from Google, and it is known that the "No print job available on specified printer." message is received even if the printer does not exist on Google Cloud. As a workaround, I am going to call GetPrinterAsync before the actual FetchJobsAsync implementation in order to throw an appropriate error.

The other one has also been modified. The library should now behaves as expected, please help to check if the problem resolves. The nuget package will be uploaded soon, thanks!

Best, Karl

Jezternz commented 7 years ago

Thats a real annoyance, I wonder if we would be better off leaving it as it was and just accept this as a sub-par experienece. The reason I say this, is that it will enable:

Also in a couple of weeks I am probably going to look into implementing an XMPP connection to google to get live updates, would you consider including it in your project (as a pull)?

Cheers, J

karlwancl commented 7 years ago

The code & nuget package has just been reverted. I have also included the default behaviour & the suggestion on this problem in README.md as a notice to future users.

For the pull, I would absolutely say YES! It would be really nice if you could help implementing the XMPP live update part for this library. Future users will thank you for this =)

Best, Karl