XWIKI-9874: Introduce getLastError() in the Wiki Script Service.

* Fix usages of getLastException which is deprecated now.