'Add an :term:`exception view` for the specified ``exception`` to
the current configuration state. The view will be called when Pyramid
or application code raises the given exception.
This method accepts almost all of the same arguments as
:meth:`pyramid.config.Configurator.add_view` except for ``name``,
``permission``, ``for_``, ``require_csrf``, and ``exception_only``.
By default, this method will set ``context=Exception``, thus
registering for most default Python exceptions. Any subclass of
``Exception`` may be specified.
.. versionadded:: 1.8'

@viewdefaults
@action_method
def add_exception_view(self, view=None, context=None, **view_options):

    for arg in ('name', 'for_', 'exception_only', 'require_csrf', 'permission'):
        if (arg in view_options):
            raise ConfigurationError(('%s    may    not    be    used    as    an    argument    to    add_exception_view' % (arg,)))
    if (context is None):
        context = Exception
    view_options.update(dict(view=view, context=context, exception_only=True, permission=NO_PERMISSION_REQUIRED, require_csrf=False))
    return self.add_view(**view_options)
