question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Non-existant file still gets its success callback called

See original GitHub issue

The following prints out “shouldnthappen”

$script('doesntExist.js', function() {
  console.log('shouldnthappen')
}, function(notFound) {
    console.log(notFound)
})

This makes me think script.js isn’t in any way production ready.

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
dedcommented, Apr 19, 2014

this is a valid concern but with all respect leave your sarcasm elsewhere. your request to change core is an opinion of which has been purposely decided in the library to load non-existent or errored files. you would otherwise never receive a callback and may mistakenly attempt to wait for an event that may never occur. it’s up to the developer to make sure their scripts load properly.

Eg:

$('cdn.jquery.com/latest.js', function () {
  if (typeof $ !== 'undefined') ready()
  else $script('/js/jquery.js', ready)
})
0reactions
kzapcommented, Dec 1, 2015

@amorey the behaviour is fine, the documentation could be more verbose 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to capture no file for fs.readFileSync()? - Stack Overflow
This will not work because the callback function passed to fs.readFile() is called asynchronously. By the time the callback has been called, the ......
Read more >
Using C++ File Streams
If you try to open a file and it fails to open (e.g. the filename is wrong), the stream object goes into a...
Read more >
open(2) - Linux manual page - man7.org
The file descriptor returned by a successful call will be the lowest-numbered file descriptor not currently open for the process. By default, the...
Read more >
How to fix "The following module is missing from the file ...
This is caused by either improperly uninstalling modules and / or modules still trying to call non existent modules in their code (as...
Read more >
On Error statement (VBA) | Microsoft Learn
When calling DLL functions, you should check each return value for success or failure (according to the API specifications), and in the event...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found