Closed Bug 300984 Opened 19 years ago Closed 17 years ago

stop creating undefined objects

Categories

(Bugzilla :: Bugzilla-General, defect)

2.21
defect
Not set
normal

Tracking

()

RESOLVED WONTFIX

People

(Reporter: LpSolit, Unassigned)

Details

We should definitely stop creating and returning undefined objects when the
parameters passed to the constructor "new Bugzilla::Module(@args)" are invalid.
We should fail using ThrowCodeError() instead.

A few minutes ago, I tried to edit the properties of a non-existent user. The
script created an undefined user object and failed when its ID was requested
later in the code. This does not make sense.

I prefer to die using ThrowCodeError() in the constructor itself than to let the
code catch it later (assuming the script is able to catch it instead of having
some strange behavior). And most of the time, it catches the undefined object by
a nice "Software error:"

This would also be a nice cleanup for this $self->{'error'} stuff in Bug.pm.
Target Milestone: --- → Bugzilla 2.22
Target Milestone: Bugzilla 2.22 → ---
OK, I changed my mind. Sometimes, you want to do the check in the caller itself and take the appropriate action.
Status: NEW → RESOLVED
Closed: 17 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.