Call err method in case of error.