Ensures that the given originalError is an instance of the given errorClass.
originalError
errorClass
import {ensureErrorClass, extractErrorMessage} from '@augment-vir/common';class MyCustomError extends Error { public override readonly name = 'MyCustomError';}try { // do some stuff} catch (error) { throw ensureErrorClass(error, MyCustomError, extractErrorMessage(error));} Copy
import {ensureErrorClass, extractErrorMessage} from '@augment-vir/common';class MyCustomError extends Error { public override readonly name = 'MyCustomError';}try { // do some stuff} catch (error) { throw ensureErrorClass(error, MyCustomError, extractErrorMessage(error));}
@augment-vir/common
Ensures that the given
originalErroris an instance of the givenerrorClass.originalErroris directly returned.errorClassis constructed with the given parameters.