A factory function to create a getter function to map a thrown error to a
more user-friendly error.
If thrown error is `MosaicError - it is re-returned as is.
If thrown error is not an instance of an Error class - MosaicError with
UnhandledError code and message is returned.
If passed mapper function returns an info object (and not undefined) -
MosaicError is returned, constructed from original error and info from
passed mapper.
If passed mapper returns a falsy value - MosaicError with
UnhandledError code and message is returned.
A factory function to create a getter function to map a thrown error to a more user-friendly error.
Error
class -MosaicError
with UnhandledError code and message is returned.mapper
function returns an info object (and not undefined) -MosaicError
is returned, constructed from original error and info from passedmapper
.MosaicError
with UnhandledError code and message is returned.