wo14580

Results 2 issues of wo14580

Since moodle 4.0 the method print_error is deprecated. [Here](https://tracker.moodle.org/browse/MDL-71062) is the moodle tracker related. This PR replace all the occurence of print_error by a moodle_exception.

I noticed they were missing the prefix"on" on 2 enum variables of the NativeEvents. I can't create an issue so I create a PR instead. Thank you