How to use badRequest in a custom service context?

I found the solution in the personal documentation, the record is here: