Moved the exception handler since it supports both versions.