I'm trying to define my error api responses in a single location as to avoid duplicating code (source code and potentially re-using error codes to mean different things in different places).
I'm trying to create a function that takes in the error class key first, then requires the error classes code key and then a value of the same type as the data element. I can get the first argument to work, but the second seems to always be never