EES-13396 better exception handling and tests