Undefined variable 'error'