Update swclustering.py

change exception types