Manually capture an exception and send it over to Sentry

@param {error} ex An exception to be logged
@param {object} options A specific set of options for this error [optional]
@return {Raven}
function captureException(ex, options) {
	    options = objectMerge$1({
	      trimHeadFrames: 0
	    }, options ? options : {});

	    if (isErrorEvent$1(ex) && ex.error) {
	      // If it is an ErrorEvent with `error` property, extract it to get actual Error
	      ex = ex.error;
	    } else if (isDOMError$1(ex) || isDOMException$1(ex)) {
	      // If it is a DOMError or DOMException (which are legacy APIs, but still supported in some browsers)
	      // then we just extract the name and message, as they don't provide anything else
	      // https://developer.mozilla.org/en-US/docs/Web/API/DOMError
	      // https://developer.mozilla.org/en-US/docs/Web/API/DOMException
	      var name = ex.name || (isDOMError$1(ex) ? 'DOMError' : 'DOMException');
	      var message = ex.message ? name + ': ' + ex.message : name;
	      return this.captureMessage(message, objectMerge$1(options, {
	        // neither DOMError or DOMException provide stack trace and we most likely wont get it this way as well
	        // but it's barely any overhead so we may at least try
	        stacktrace: true,
	        trimHeadFrames: options.trimHeadFrames + 1
	      }));
	    } else if (isError$1(ex)) {
	      // we have a real Error object
	      ex = ex;
	    } else if (isPlainObject$1(ex)) {
	      // If it is plain Object, serialize it manually and extract options
	      // This will allow us to group events based on top-level keys
	      // which is much better than creating new group when any key/value change
	      options = this._getCaptureExceptionOptionsFromPlainObject(options, ex);
	      ex = new Error(options.message);
	    } else {
	      // If none of previous checks were valid, then it means that
	      // it's not a DOMError/DOMException
	      // it's not a plain Object
	      // it's not a valid ErrorEvent (one with an error property)
	      // it's not an Error
	      // So bail out and capture it as a simple message:
	      return this.captureMessage(ex, objectMerge$1(options, {
	        stacktrace: true,
	        // if we fall back to captureMessage, default to attempting a new trace
	        trimHeadFrames: options.trimHeadFrames + 1
	      }));
	    } // Store the raw exception object for potential debugging and introspection


	    this._lastCapturedException = ex; // TraceKit.report will re-raise any exception passed to it,
	    // which means you have to wrap it in try/catch. Instead, we
	    // can wrap it here and only re-raise if TraceKit.report
	    // raises an exception different from the one we asked to
	    // report on.

	    try {
	      var stack = tracekit.computeStackTrace(ex);

	      this._handleStackInfo(stack, options);
	    } catch (ex1) {
	      if (ex !== ex1) {
	        throw ex1;
	      }
	    }

	    return this;
	  }