我正在尝试将stackdriver-error-js 库作为模块集成到我的 Vue 项目中。
代码和设置:
在 package.json
"stackdriver-errors-js": "^0.2.0"
在 bootstrap.js 中
import errorHandler from './error/error-reporting';
在 error-reporting.js 中
import { StackdriverErrorReporter } from 'stackdriver-errors-js';
let errorHandler;
errorHandler = new StackdriverErrorReporter();
errorHandler.start({
key: "{{.Config.StackDriverApiKey}}",
projectId: "{{.Config.StackDriverProject}}",
service: "{{.Config.GoogleCloudProjectID}}",
version: "{{.Copacknfig.GaeEnv}}",
disabled: false
});
export default errorHandler;
实际错误
我现在得到的错误是(控制台输出和测试)
[vue-devtools] Ready. Detected Vue v2.4.2
(function testErrorReporting() {window.onerror(null, null, null, null, new Error('Test: Something broke!'));})();
stackdriver-errors.js:109 Uncaught ReferenceError: StackTrace is not defined
at StackdriverErrorReporter.webpackJsonp.556.StackdriverErrorReporter.report (stackdriver-errors.js:109)
at window.onerror (stackdriver-errors.js:67)
at testErrorReporting (<anonymous>:1:40)
at <anonymous>:1:111
和行(stackdriver-errors.js:109)
...
StackTrace.fromError(err).then(function(stack){
...