Use standard .NET exceptions

This change replaces instances where `MgException` is thrown with standard .NET exception that are appropriate for the particular situation. Since `MgException` and its base class `_ErrorException` are no longer used afterwards, they are removed.