GithubHelp home page GithubHelp logo

Comments (11)

mohuishou avatar mohuishou commented on June 2, 2024

看一下 preload.ts 和 preload.js 的内容

from utools.

Nstd avatar Nstd commented on June 2, 2024

@mohuishou

preload.ts

import { InitPlugins } from "utools-helper";
import { SearchApi } from "./search-api";

InitPlugins([new SearchApi()]);

preload.js

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const utools_helper_1 = require("utools-helper");
const search_api_1 = require("./search-api");
utools_helper_1.InitPlugins([new search_api_1.SearchApi()]);

from utools.

Nstd avatar Nstd commented on June 2, 2024

@mohuishou

utools-helperplugin.ts 文件中有个错误信息,不知道这个有没有影响
image

from utools.

mohuishou avatar mohuishou commented on June 2, 2024

@mohuishou

utools-helperplugin.ts 文件中有个错误信息,不知道这个有没有影响
image

应该和这个没有关系,大概率你这个 SearchApi 对象初始化的时候会抛异常导致的,导致 window.exports 这行代码没执行到

from utools.

Nstd avatar Nstd commented on June 2, 2024

@mohuishou
utools-helperplugin.ts 文件中有个错误信息,不知道这个有没有影响
image

应该和这个没有关系,大概率你这个 SearchApi 对象初始化的时候会抛异常导致的,导致 window.exports 这行代码没执行到

有什么办法能捕捉到这个异常吗?

from utools.

mohuishou avatar mohuishou commented on June 2, 2024

我这边已经尝试捕获了,但是由于 utools 的机制问题导致错误还没有弹出插件就退出了,这个后面我看一下能不能输出到一个日志文件里面去,现在临时解决方案,你可以尝试改一下 node_modules 的 dist 里面的文件,尝试加一些 alert 之类的

from utools.

Nstd avatar Nstd commented on June 2, 2024

我这边已经尝试捕获了,但是由于 utools 的机制问题导致错误还没有弹出插件就退出了,这个后面我看一下能不能输出到一个日志文件里面去,现在临时解决方案,你可以尝试改一下 node_modules 的 dist 里面的文件,尝试加一些 alert 之类的

写了个test case,发现是少安装了一个库,感谢!

from utools.

Nstd avatar Nstd commented on June 2, 2024

utools没法看到运行日志,真难受。。

from utools.

mohuishou avatar mohuishou commented on June 2, 2024

utools没法看到运行日志,真难受。。

是的,调试起来比较麻烦

from utools.

mohuishou avatar mohuishou commented on June 2, 2024

preload.ts 这么写就可以捕获错误了

try {
  InitPlugins([new VSCode(), new CMD(), new Setting(), new Storage()]);
} catch (error) {
  alert(error.stack ? error.stack : error);
}

from utools.

Nstd avatar Nstd commented on June 2, 2024

preload.ts 这么写就可以捕获错误了

try {
  InitPlugins([new VSCode(), new CMD(), new Setting(), new Storage()]);
} catch (error) {
  alert(error.stack ? error.stack : error);
}

多谢

from utools.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.