hexo-cli icon indicating copy to clipboard operation
hexo-cli copied to clipboard

Enhancement, give more helpful error when hexo server

Open sukrosono opened this issue 3 years ago • 0 comments

I think it good to have a better warning, in this case when hexo server is blocked by some errors. It must be implemented when using --debug option, but personally i think should be enabled by default.

I have encounter an example, i am using new plugin, hexo-covers. Do some mistake when configuring it, it just give some error:

Scanning posts to extract category/data: /home/enter/adi_doc/project/git_project/enter-rebel.github.io/source/
11:49:16.133 FATAL { err:
   TypeError: (categories || []).flat(...) is not a function or its return value is not iterable
       at findAllFiles.reduce (/home/enter/adi_doc/project/git_project/enter-rebel.github.io/node_modules/hexo-covers/lib/invalidateCovers.js:61:90)
       at Array.reduce (<anonymous>)
       at getCoversToGenerate (/home/enter/adi_doc/project/git_project/enter-rebel.github.io/node_modules/hexo-covers/lib/invalidateCovers.js:56:73)
       at /home/enter/adi_doc/project/git_project/enter-rebel.github.io/node_modules/hexo-covers/lib/invalidateCovers.js:198:34
       at Hexo.<anonymous> (/home/enter/adi_doc/project/git_project/enter-rebel.github.io/node_modules/hexo-covers/index.js:93:20)
       at Hexo.tryCatcher (/home/enter/adi_doc/project/git_project/enter-rebel.github.io/node_modules/bluebird/js/release/util.js:16:23)
       at Hexo.<anonymous> (/home/enter/adi_doc/project/git_project/enter-rebel.github.io/node_modules/bluebird/js/release/method.js:15:34)
       at Promise.each.filter (/home/enter/adi_doc/project/git_project/enter-rebel.github.io/node_modules/hexo/lib/extend/filter.js:67:52)
       at tryCatcher (/home/enter/adi_doc/project/git_project/enter-rebel.github.io/node_modules/bluebird/js/release/util.js:16:23)
       at Object.gotValue (/home/enter/adi_doc/project/git_project/enter-rebel.github.io/node_modules/bluebird/js/release/reduce.js:166:18)
       at Object.gotAccum (/home/enter/adi_doc/project/git_project/enter-rebel.github.io/node_modules/bluebird/js/release/reduce.js:155:25)
       at Object.tryCatcher (/home/enter/adi_doc/project/git_project/enter-rebel.github.io/node_modules/bluebird/js/release/util.js:16:23)
       at Promise._settlePromiseFromHandler (/home/enter/adi_doc/project/git_project/enter-rebel.github.io/node_modules/bluebird/js/release/promise.js:547:31)
       at Promise._settlePromise (/home/enter/adi_doc/project/git_project/enter-rebel.github.io/node_modules/bluebird/js/release/promise.js:604:18)
       at Promise._settlePromise0 (/home/enter/adi_doc/project/git_project/enter-rebel.github.io/node_modules/bluebird/js/release/promise.js:649:10)
       at Promise._settlePromises (/home/enter/adi_doc/project/git_project/enter-rebel.github.io/node_modules/bluebird/js/release/promise.js:729:18) } 'Something\'s wrong. Maybe you can find the solution here: %s' '\u001b[4mhttps://hexo.io/docs/troubleshooting.html\u001b[24m'

IMO the better error should be: Fatal, encounters plugins block level error, you have installed x plugin, It's good to try to disable it?

Cheers

sukrosono avatar May 02 '21 12:05 sukrosono