catch error to get class name