I believe a proper error is in place now so that should help:
https://github.com/discourse/discourse/pull/20585