MDL-48008 grade import: fix error handling.