add assert for error not nil