raise_error function is not necessary because it uses anonymous functions