diff --git a/src/magick-image.ts b/src/magick-image.ts index 0e8b3d5..be122e2 100644 --- a/src/magick-image.ts +++ b/src/magick-image.ts @@ -3172,18 +3172,14 @@ export class MagickImage extends NativeInstance implements IMagickImage { } private useException(func: (exception: Exception) => TReturnType): TReturnType { - return Exception.use(exception => { - return func(exception); - }, (error: MagickError) => { + return Exception.use(func, error => { if (this.onWarning !== undefined) this.onWarning(new WarningEvent(error)); }); } private useExceptionPointer(func: (exception: number) => TReturnType): TReturnType { - return Exception.usePointer(exception => { - return func(exception); - }, (error: MagickError) => { + return Exception.usePointer(func, error => { if (this.onWarning !== undefined) this.onWarning(new WarningEvent(error)); });