When to raise an exception?
问题 I think this is a "best practice" category question: I have a custom control - some kind of grid that holds some panels. One of the panels is the current active panel (the last one clicked). TMyGrid = class (TSomeKindOfGrid) published property CurrentPanel: TPanel read getCurPanel write setCurPanel; end; My question is: if at a certain point someone asks for the CurrentPanel and the grid is empty, should getCurPanel return a NIL or should it raise an exception? If getCurPanel returns NIL,