Perhaps a new error type should be added to `xmodule/exceptions.py` to account for invalid requests, which xmodules could raise to indicate that the request is invalid. However, that seems outside the scope of this pull request, and anyway, I don't think we want to spend more time and effort developing xmodules, so it doesn't seem worthwhile. Since xmodule doesn't support what I was looking for, this is fine.