more complete exception handling example