The parse_except_messages() method parses errors raised by SplunkRESTModel operations into a flat list.
Note: In general, this method does not need to be called explicitly. It is used by passive_save() to handle error messaging, usually to pass the error messages to a template.
messages = parse_except_messages( e )
|
e |
Object |
Exception message to parse. |
|
List |
List of error message strings. |
from splunk.models.base import SplunkRESTModel
class MyAppModel(SplunkRESTModel):
def errorMsgs(self):
self.errors = []
try:
... elided ...
except Exception, e:
self.errors =
[x.replace("In handler 'savedsearch':", '').lstrip() for x in self.parse_except_messages(e)]
return False
else:
return True