Can you explain a bit more what you'd like in the Error meta-data? As I understood it, you are supposed to put the file/line of the expression that raised the error (and you can use rescue_metadata to wrap a block with that), but here, although we are iterating on the order_bys (and thus we could extract an expression from that -> rescue_metadata woudl work), the problem isn't on the order_bys, as brillantly demonstrated above (not)...

So... would you like me to try to rewrite this in a way that iterates over the distinct expr and put the correct metadata accordingly (maybe it's possible..?), should I just blame the poor order_bys expressions or did you have something else in mind?

Thanks!