"""Exception classes used throughout the FindTrajectory project.

AUTHOR: <NAME> <<EMAIL>>, Department of Chemistry, University of Liverpool, UK.
RELEASE: 2022-02-04, version 0.1. DEPENDENCIES: Python 3.6. LICENCE: Please see LICENCE.txt for more details.
"""

class AppError(Exception):
	"""General friendly application error"""
	
	def __init__(self,myErrMsg,*arglist): # Python semantics include optional arglist
		super(AppError,self).__init__(myErrMsg,*arglist)
		
		# additional details set at higher levels in the call stack:
		self.sDatasetId=None
		self.sHostCrystalId=None # CIF filename of crystal related to error.
		self.sHostCrystalCifFileName=None # CIF filename of crystal related to error.
		
	def __str__(self):
		sErrMsg= super(AppError,self).args[0]
		return sErrMsg if self.sHostCrystalCifFileName is None else "%s [dataset %s; crystal %s; CIF %s]" % (sErrMsg,self.sDatasetId,self.sHostCrystalId,self.sHostCrystalCifFileName)

class FailedFit(Exception):
	def __init__(self,myErrMsg,*arglist):
		super(FailedFit,self).__init__(myErrMsg,*arglist)
"""Exception classes used throughout the FindTrajectory project.

AUTHOR: <NAME> <<EMAIL>>, Department of Chemistry, University of Liverpool, UK.
RELEASE: 2022-02-04, version 0.1. DEPENDENCIES: Python 3.6. LICENCE: Please see LICENCE.txt for more details.
"""

class AppError(Exception):
	"""General friendly application error"""
	
	def __init__(self,myErrMsg,*arglist): # Python semantics include optional arglist
		super(AppError,self).__init__(myErrMsg,*arglist)
		
		# additional details set at higher levels in the call stack:
		self.sDatasetId=None
		self.sHostCrystalId=None # CIF filename of crystal related to error.
		self.sHostCrystalCifFileName=None # CIF filename of crystal related to error.
		
	def __str__(self):
		sErrMsg= super(AppError,self).args[0]
		return sErrMsg if self.sHostCrystalCifFileName is None else "%s [dataset %s; crystal %s; CIF %s]" % (sErrMsg,self.sDatasetId,self.sHostCrystalId,self.sHostCrystalCifFileName)

class FailedFit(Exception):
	def __init__(self,myErrMsg,*arglist):
		super(FailedFit,self).__init__(myErrMsg,*arglist)
Exception classes used throughout the FindTrajectory project.  AUTHOR: <NAME> <<EMAIL>>, Department of Chemistry, University of Liverpool, UK. RELEASE: 2022-02-04, version 0.1. DEPENDENCIES: Python 3.6. LICENCE: Please see LICENCE.txt for more details. General friendly application error # Python semantics include optional arglist # additional details set at higher levels in the call stack: # CIF filename of crystal related to error. # CIF filename of crystal related to error.