ensure<T, U, E>(error, create?, options?): T extends E ? T : U
Will return error if an instance of Error is passed;
otherwise, when lacking a create function,
it will instantiate an Exception and return it.
When a new Exception is created, Exception.data
will be populated with error.
Will return
errorif an instance ofErroris passed; otherwise, when lacking acreatefunction, it will instantiate anExceptionand return it. When a newExceptionis created,Exception.datawill be populated witherror.