http-vue-loader icon indicating copy to clipboard operation
http-vue-loader copied to clipboard

Error and warning handling in SFCs

Open sp00x opened this issue 6 years ago • 2 comments

Is there any way of handling errors or warnings in the SFCs, or at least detect if an error has occurred at run-time?

If a do a major no-no like {{null.null}} it will raise a high-level Error that bubbles up to the $root .errorHandler event, and is also captured by any errorCaptured handlers, so that can sort of be dealt with.

However if I pass in a template that has something like {{ "".toUpperCase] }} the javascript console (in development mode only!) will print: a [Vue warn]: Error compiling template: and invalid expression: missing ) after argument list in, and the entire template fails to render anything at all.

It does return a VueComponent object, but I'm not sure if there's anything in it I can check for if things went sour or not..

ref:

  • https://vuejs.org/v2/api/#errorHandler
  • https://vuejs.org/v2/api/#warnHandler (not available in production mode)
  • https://vuejs.org/v2/api/#errorCaptured

sp00x avatar Nov 01 '18 14:11 sp00x

I am not sure compile-time errors may be bail.

FranckFreiburger avatar Nov 12 '18 13:11 FranckFreiburger

How can I get this level of verbosity in error reporting? On my development build, if any syntax error exists in the .vue file, all I get is a ReferenceError, "responseText is not defined" when importing the vue file. How can the verbosity of error output be increased and/or enabled to show script/template syntax errors?

ryangriggs avatar Jan 20 '20 12:01 ryangriggs