The advantage of creating your own exception class is better documentation of the offending condition. By using inheritance you allow exceptions to be caught by general-purpose catch mechanisms (i.e., one that uses the parent class, rather than the child class).