Forbid file rename

@rullzer @icewind I listen an file pre rename event, then check some conditions and if its fails I want to throw ForbiddenException with 403 response code. But nextcloud ignore everything except HintException and return 500 status code if I throw HintException.
What is correct approach to forbid file rename?