vim-maktaba icon indicating copy to clipboard operation
vim-maktaba copied to clipboard

maktaba#plugin#Enter chokes with cryptic E896 error if it finds a flag called "plugin"

Open dbarnett opened this issue 5 years ago • 1 comments

If you configure a plugin with a typo like Glaive someplugin plugin, you end up with very ugly errors from maktaba when it encounters a flag plugin=1 instead of the dictionary it expects. The error message doesn't help at all to figure out what's wrong and how to change the Glaive line to fix it (by removing the stray plugin or changing it to a valid flag like plugin[mappings]).

Sample cryptic error output that should be improved:

Error detected while processing function maktaba#plugin#Enter:
line   25:
E896: Argument of get() must be a List, Dictionary or Blob
Error detected while processing ~/.vim/plugged/vim-codefmt/plugin/autocmds.vim:
line   20:
E714: List required
line   21:
E121: Undefined variable: s:enter
Error detected while processing function maktaba#plugin#Enter:
line   25:
E896: Argument of get() must be a List, Dictionary or Blob
Error detected while processing ~/.vim/plugged/vim-codefmt/plugin/commands.vim:
line   15:
E714: List required
line   16:
E121: Undefined variable: s:enter
Error detected while processing function maktaba#plugin#Enter:
line   25:
E896: Argument of get() must be a List, Dictionary or Blob
Error detected while processing ~/.vim/plugged/vim-codefmt/plugin/mappings.vim:
line   33:
E714: List required
line   34:
E121: Undefined variable: s:enter
line   39:
E121: Undefined variable: s:plugin
line   44:
E121: Undefined variable: s:prefix
line   50:
E121: Undefined variable: s:prefix
line   56:
E121: Undefined variable: s:prefix
line   61:
E121: Undefined variable: s:prefix
Error detected while processing function maktaba#plugin#Enter:
line   25:
E896: Argument of get() must be a List, Dictionary or Blob
Error detected while processing ~/.vim/plugged/vim-codefmt/plugin/register.vim:
line   15:
E714: List required
line   16:
E121: Undefined variable: s:enter
line   21:
E121: Undefined variable: s:plugin
line   22:
E121: Undefined variable: s:registry
line   26:
E121: Undefined variable: s:registry
line   27:
…

dbarnett avatar Oct 21 '20 18:10 dbarnett

A better error would say something like Invalid flag "plugin" for plugin "someplugin": Expected a dictionary. Got a number..

dbarnett avatar Oct 21 '20 18:10 dbarnett