grocy-android icon indicating copy to clipboard operation
grocy-android copied to clipboard

Show error message from backend (in case of consuming recipe if ingredients with disabled stock fulfillment checking)

Open rugk opened this issue 9 months ago • 2 comments

STR

See https://github.com/grocy/grocy/issues/2533 TL;DR: Make a recipe with an ingredient with "stock fulfillment checking" disabled. Not have it in stock.

Then try to consume the recipe from the app.

What happens

https://github.com/patzly/grocy-android/assets/11966684/69f2b06a-94f3-4da4-abdf-3df5ae31019a

Just shows a very generic error:

Netzwerkfehler

com.android.volley.ClientError
	at com.android.volley.toolbox.BasicNetwork.performRequest(BasicNetwork.java:257)
	at com.android.volley.NetworkDispatcher.processRequest(NetworkDispatcher.java:62)
	at com.android.volley.NetworkDispatcher.run(NetworkDispatcher.java:6)

A server error is shown, but no details. Grocy web, shows this instead:

"{\"error_message\":\"Amount to be consumed cannot be > current stock amount (if supplied, at the desired location)\"}"

What should happen

You may at least pass that error message to the user?

rugk avatar May 04 '24 15:05 rugk

Thanks for the suggestion, I will look whether the API does return the error too.

dominiczedler avatar May 05 '24 07:05 dominiczedler

Thanks yeah, maybe you can also show the stock amount even for "stock fulfillment checking"-disabled ingredients to prevent this error from occurring initially. (Especially, as – as indicated upstream – the error message, even if displayed, does not mention the bad ingredient, which can lead to painful debugging of your recipe :sweat_smile:) Everything else would AFAIK need server support/changes in the general handling, as suggested in https://github.com/grocy/grocy/issues/2533.

rugk avatar May 05 '24 13:05 rugk