Requirements:
-
Section is created by selecting one teacher, one subject and one
schedule. -
System verifies that all business rules are followed.
-
System detects that a business rule is not being followed.
-
System informs user of conflict.
-
System doesn’t create new section.
-
3.System creates new section.
My problem is, if I define a constructor for section, Section(Teacher t, Subject s, Schedule c), I don’t know how to return the error message for the conflict.
Should I just let my constructor throw an exception? If yes, how to return a string from a caught exception? How to create that exception?
Or is there any better, yet simple, implementation?
Reporting constructor failure boils down to two options: