mirror of
				https://github.com/ARM-software/devlib.git
				synced 2025-11-04 07:51:21 +00:00 
			
		
		
		
	exception: Deal with missing _message attribute
Allow subclasses of DevlibError to not have a _message attribute, in which case it falls back on str(self), just as when _message is None.
This commit is contained in:
		
				
					committed by
					
						
						Marc Bonnici
					
				
			
			
				
	
			
			
			
						parent
						
							f1c8ca1a66
						
					
				
				
					commit
					ff57e785f8
				
			@@ -22,10 +22,15 @@ class DevlibError(Exception):
 | 
			
		||||
 | 
			
		||||
    @property
 | 
			
		||||
    def message(self):
 | 
			
		||||
        if self._message is not None:
 | 
			
		||||
            return self._message
 | 
			
		||||
        else:
 | 
			
		||||
        try:
 | 
			
		||||
            msg = self._message
 | 
			
		||||
        except AttributeError:
 | 
			
		||||
            msg = None
 | 
			
		||||
 | 
			
		||||
        if msg is None:
 | 
			
		||||
            return str(self)
 | 
			
		||||
        else:
 | 
			
		||||
            return self._message
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class DevlibStableError(DevlibError):
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user