def get_fields_for_exception(self, logger, exception):
        """
        Given an exception instance, return fields to add to the failed action
        message.

        @param logger: ``ILogger`` currently being used.
        @param exception: An exception instance.

        @return: Dictionary with fields to include.
        """
        for klass in getmro(exception.__class__):
            if klass in self.registry:
                extractor = self.registry[klass]
                try:
                    return extractor(exception)
                except:
                    from ._traceback import write_traceback
                    write_traceback(logger)
                    return {}
        return {}
Given an exception instance, return fields to add to the failed action
        message.

        @param logger: ``ILogger`` currently being used.
        @param exception: An exception instance.

        @return: Dictionary with fields to include.