Function: AfterThrow()
Less than 1 minute
AspectJS • Docs
Function: AfterThrow()
AfterThrow(...
args
):MethodDecorator
Annotation to declare an advice to be applied after a method throws an exception.
The AfterThrow annotation is used to apply after-throwing advice to a method. After-throwing advice is executed after the target method throws an exception. It is commonly used to handle exceptions, perform cleanup tasks, or additional actions that need to be executed after an exception is thrown.
Parameters
• ...args: PointcutExpression
<PointcutKind
>[]
Returns
MethodDecorator
An ES decorator representing the AfterThrow annotation.
Example
import { AfterThrow, on } from '@aspectjs/core';
class MyClass {
@AfterThrow(on.classes.withAnnotations(SomeAnnotation))
myMethod() {
// Method implementation
}
}
Defined in
packages/core/src/advices/after-throw/after-throw.annotation.ts:29