• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

exception

 
mandy fern
Greenhorn
Posts: 12
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do I write an exception class for a wrong isbn number format?
 
Cindy Glass
"The Hood"
Sheriff
Posts: 8521
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What are the rules for editing an ISBN number format?
 
mandy fern
Greenhorn
Posts: 12
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The rules are 2 numbers space 2 numbers space 3 numbers space 3 numbers
 
Cindy Glass
"The Hood"
Sheriff
Posts: 8521
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually, the exception class would not need to do much except print an error message. Here is a sample (I stole the code from IOException)

It does almost nothing.
What you probably want is an ISBN class that has a constructor or a validate() method that throws the ISBNException.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic