Skip to content
v2.275.0

Errors Class ​

Helper to check if an error is of a certain type.

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';
const errors = new cdk.Errors();
python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk as cdk

errors = cdk.Errors()
java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.*;

Errors errors = new Errors();
csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK;

var errors = new Errors();
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import cdk "github.com/aws/aws-cdk-go/awscdk"

errors := cdk.NewErrors()

Initializer ​

ts
new Errors()
python
Errors()
java
new Errors()
csharp
new Errors()
go
NewErrors()

Methods ​

isAssertionError(x: any): boolean@staticmethod def is_assertion_error(x: Any) -> boolpublic static Boolean isAssertionError(Object x)public static bool IsAssertionError(object x)func IsAssertionError(X interface{}) *boolstatic#
Test whether the given error is a AssertionError.

An AssertionError is thrown when an assertion fails.

isAssumptionError(x: any): boolean@staticmethod def is_assumption_error(x: Any) -> boolpublic static Boolean isAssumptionError(Object x)public static bool IsAssumptionError(object x)func IsAssumptionError(X interface{}) *boolstatic#
Test whether the given error is an AssumptionError.

An AssumptionError is thrown when a construct made an assumption somewhere that doesn't hold true. This error always indicates a bug in the construct.

isCloudAssemblyError(x: any): boolean@staticmethod def is_cloud_assembly_error(x: Any) -> boolpublic static Boolean isCloudAssemblyError(Object x)public static bool IsCloudAssemblyError(object x)func IsCloudAssemblyError(X interface{}) *boolstatic#
Test whether the given error is a CloudAssemblyError.

A CloudAssemblyError is thrown for unexpected problems with the synthesized assembly.

isConstructError(x: any): boolean@staticmethod def is_construct_error(x: Any) -> boolpublic static Boolean isConstructError(Object x)public static bool IsConstructError(object x)func IsConstructError(X interface{}) *boolstatic#
Test whether the given errors is a ConstructionError.

A ConstructionError is a generic error that will be thrown during the App construction or synthesis. To check for more specific errors, use the respective methods.

isExecutionError(x: any): boolean@staticmethod def is_execution_error(x: Any) -> boolpublic static Boolean isExecutionError(Object x)public static bool IsExecutionError(object x)func IsExecutionError(X interface{}) *boolstatic#
Test whether the given error is an ExecutionError.

An ExecutionError is thrown if an externally executed script or code failed.

isValidationError(x: any): boolean@staticmethod def is_validation_error(x: Any) -> boolpublic static Boolean isValidationError(Object x)public static bool IsValidationError(object x)func IsValidationError(X interface{}) *boolstatic#
Test whether the given error is a ValidationError.

A ValidationError is thrown when input props are failing to pass the rules of the construct. It usually means the underlying CloudFormation resource(s) would not deploy with a given configuration.