Added function onLoadError

Added function onLoadError