ArcGIS Pro 2.6 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, Windows 7

See Also

Reference

IGPResult Interface
IGPResult Members