The documentation for EditPage::internalAttemptSave() has the following comment:
* @todo FIXME: This interface is TERRIBLE, but hard to get rid of due to * various error display idiosyncrasies. There are also lots of cases * where error metadata is set in the object and retrieved later instead * of being returned, e.g. AS_CONTENT_TOO_BIG and * AS_BLOCKED_PAGE_FOR_USER. All that stuff needs to be cleaned up some * time.
We should fix this by extracting all the anti-spam/vandalism checks (plus hooks) out of EditPage, and into a pluggable interface (that ideally promotes best practices like T59026: Bot being served Error: 503, Service Unavailable (default error page) for API action=edit requests on large pages (caused by parsing the page three times on save)).
EditPage would call into this to determine whether the edit is OK or not, and then update the UI accordingly.