Table of Contents

Class ValidationResult

Namespace
Amazon.CDK
Assembly
Amazon.CDK.dll

Representation of validation results.

public class ValidationResult : DeputyBase
Inheritance
ValidationResult

Examples

// The code below shows an example of how to instantiate this type.
             // The values are placeholders you should change.
             using Amazon.CDK;

             ValidationResults validationResults;
             var validationResult = new ValidationResult("errorMessage", validationResults);

Remarks

Models a tree of validation errors so that we have as much information as possible about the failure that occurred.

ExampleMetadata: fixture=_generated

Constructors

ValidationResult(string?, ValidationResults?)

public ValidationResult(string? errorMessage = null, ValidationResults? results = null)

Parameters

errorMessage string
results ValidationResults

Properties

ErrorMessage

public virtual string ErrorMessage { get; }

Property Value

string

IsSuccess

public virtual bool IsSuccess { get; }

Property Value

bool

Results

public virtual ValidationResults Results { get; }

Property Value

ValidationResults

Methods

AssertSuccess()

Turn a failed validation into an exception.

public virtual void AssertSuccess()

ErrorTree()

Return a string rendering of the tree of validation failures.

public virtual string ErrorTree()

Returns

string

Prefix(string)

Wrap this result with an error message, if it concerns an error.

public virtual ValidationResult Prefix(string message)

Parameters

message string

Returns

ValidationResult