[mms-lib] Improving error handling