options.onError function could catch errors that are thrown in options.onNoMatch handler. So we could explicit throw custom error in onNoMatch function.
As a result, all errors will be processed in one place.
import { NotFoundError } from 'errors/not-found-error';
export const onNoMatch = (): void => {
throw new NotFoundError();
};
options.onError
function could catch errors that are thrown inoptions.onNoMatch
handler. So we could explicit throw custom error in onNoMatch function. As a result, all errors will be processed in one place.