Ask away

Require js component error handling

Fritz 01/13/18 04:04

73 views

Question CategoryMiscellaneous

Number of completed projects0

Question StatusUnsolved

  • JS
  • error
  • handling
  • component

Question

I am developing a nest application. I like to know how do I handle the require JS errors. In low internet speed, requireJS generate errors like "timeout", "module not loaded" etc.

Answers

1
Bob 01/23/18 10:42

The general class of errors are 404s for scripts (not found), network timeouts or errors in the scripts that are loaded. RequireJS has a few tools to deal with them: require-specific errbacks, a "paths" array config, and a global requirejs.onError. The error object passed to errbacks and the global requirejs.onError function will usually contain two custom properties: requireType: A string value with a general classification, like "timeout", "nodefine", "scripterror". requireModules: an array of module names/URLs that timed out. If you get an error with a requireModules, it probably means other modules that depend on the modules in that requireModules array are not defined.

Answer

Project

Image

Comment