Checking that callback is of type function and that `type` is set before being used in error message