Add global error function.