Package mindmeister :: Module diagnostic
[hide private]
[frames] | no frames]

Source Code for Module mindmeister.diagnostic

 1  ''' 
 2  Copyright 2012 Alexey Kravets  <mr.kayrick@gmail.com> 
 3   
 4  This file is part of PythonMindmeister. 
 5   
 6  PythonMindmeister is free software: you can redistribute it and/or modify 
 7  it under the terms of the GNU General Public License as published by 
 8  the Free Software Foundation, either version 3 of the License, or 
 9  (at your option) any later version. 
10   
11  PythonMindmeister is distributed in the hope that it will be useful, 
12  but WITHOUT ANY WARRANTY; without even the implied warranty of 
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
14  GNU General Public License for more details. 
15   
16  You should have received a copy of the GNU General Public License 
17  along with PythonMindmeister.  If not, see <http://www.gnu.org/licenses/>. 
18   
19  This file implement MindException class,  which is used for error handling within 
20  PythonMindmeister library. 
21   
22  This product uses the MindMeister API but is not endorsed or certified 
23  by MindMeister. 
24  ''' 
25   
26   
27 -class MindException (Exception):
28 ''' 29 This class implements Exception class used for PythonMindmeister errors 30 caused by error responses from mindmeister.org. 31 ''' 32
33 - def __init__(self, method, data):
34 ''' 35 Create new exception from mindmeister error response. 36 37 Arguments: 38 method -- name of the failed method 39 data -- xml tree of the response 40 ''' 41 self.method = method 42 self.message = data.attrib['msg'] 43 self.code = data.attrib['code']
44
45 - def __str__(self):
46 ''' 47 Convert object to string. 48 ''' 49 return str(self.method) + " failed: " + str(self.message) + " (code " + str (self.code) + ")"
50