ArcGIS Pro 2.7 API Reference Guide
ErrorMessages Property
Example 

ArcGIS.Desktop.Core.Geoprocessing Namespace > IGPResult Interface : ErrorMessages Property
Returns error messages - see code example below:
Syntax
IEnumerable<IGPMessage> ErrorMessages {get;}
ReadOnly Property ErrorMessages As IEnumerable(Of IGPMessage)
Example
var warnings = result.Messages.Where(it => it.Type == GPMessageType.Error);
Requirements

Target Platforms: Windows 10, Windows 8.1

See Also

Reference

IGPResult Interface
IGPResult Members