Localised Response Message

Options
It would be of great help for me if the Precondition message could be in different languages. I wrote a function to get the localised message with a language_code as parameter and a key to find the message. The messages are stored in a table with different columns for each language code. The function then returns the message in the requested language.
At the moment I call this function before every Precondition and save it into a variable and if the Precondition throws an error it responds with the localised message. It would be much nicer if I could call the function within the Precondition message and only if it throws an error. Alternatively I could use an IF conditional statement that loads the localised message with my function and returns an error response. At the moment it doesn't seem to be possible to return an error response, only responses with status 200 can be returned as far as I know.
Please also see the example screen print ...[Screenshot 2022-08-04 at 15.16.01.png]

Comments