gi: support defining error