Clarification on Generate Label Webhook response status

Hi,

The docs for the Generate Label Webhook specify that:

Any errors must be returned with a status code of 500.

However, below the code sample, they also specify a response:

{
  "code": "4xx or 5xx",
  "error": "Some validation error"
}

Is a 4xx response status acceptable? If so, what are the implications?

Reasoning: We currently use a 500 status for errors, but it also serves to communicate with the packer (e.g. “You can’t use that packaging with that item.” This works well for communication, but since 500 errors get logged for debugging reasons, it creates a unnecessary logs that need to be looked at.

Thanks for the help!

Hi @david!
Thanks for pointing that out, I will change it on out docs.

Code 4xx should work. In my case I created an endpoint that returned a Code 400 and in the body:

{ “code”: “400”, “error”: “Custom Error Message” }

And this is what I got in the UI:

Screen Shot 2021-05-27 at 14.47.50

So it will display whatever message you are returning.
Let us know if that doesn’t help.

Thanks in advance!
Tom