Application Framework Reference

Model API

parse_except_messages()

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.

Synopsis

messages = parse_except_messages( e )

Parameters

e

Object

Exception message to parse.

Return Value

List

List of error message strings.

Example

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
 

See Also

passive_save()