# ValidationResult

Representation of validation results.

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

- Source: [`core/lib/runtime.ts`](https://github.com/aws/aws-cdk/blob/v2.275.0/packages/aws-cdk-lib/core/lib/runtime.ts#L148)

## Example

```ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import * as cdk from 'aws-cdk-lib';

declare const validationResults: cdk.ValidationResults;
const validationResult = new cdk.ValidationResult(/* all optional props */ 'errorMessage', /* all optional props */ validationResults);
```

## Initializer

```ts
new ValidationResult(errorMessage?: string, results?: ValidationResults)
```

## Properties

- `errorMessage`: string

- `isSuccess`: boolean

- `results`: [ValidationResults](/cdk/api/v2/docs/aws-cdk-lib.ValidationResults.html)

## Methods

- `assertSuccess(): void` — Turn a failed validation into an exception.

- `errorTree(): string` — Return a string rendering of the tree of validation failures.

- `prefix(message: string): ValidationResult // chainable` — Wrap this result with an error message, if it concerns an error.
