Page MenuHomePhabricator

ResourceLoader: Make file-not-found failures easier to detect
Closed, ResolvedPublic

Description

If one creates a module with files that don't exist (or better yet, remove files in a module and forget to update the definition) - and the module can even be loaded on all pages. Then nothing will be visible.

  • No console logs (whether with or without debug enabled)
  • No PHP exceptions

The only thing shown:

  • look up the load.php request in the browser debugger and see the exception in a javascript comment about file not found. And here it also shows the call to mw.loader.state({'foo':'missing'});

But since it is loaded with load() and not using() there is no other visible failure.

I'm note sure if throwing an exception on page views is wise, but it should at least make unit tests fail. One way or another.


Version: 1.17.x
Severity: normal

Details

Reference
bz38127

Event Timeline

bzimport raised the priority of this task from to Low.Nov 22 2014, 12:52 AM
bzimport set Reference to bz38127.
bzimport added a subscriber: Unknown Object (MLST).

This would prevent Ib40d09071ba315da6b17fc94cca5746ed4c26342

At least a console.log() (if console exists) would be nice.

We don't necessarily want to break processing by throwing an exception, so that one plugin being missing doesn't explode the site...

Yeah, as far as the production flow goes, this isn't an issue. The server properly response with mw.loader.state({'foo':'missing'}) pointing the state machine in the right direction and handling of dependencies all go as expected. Nothing is visibly failing or stuck half-way initialization.

I find interesting that the server responds with "missing" instead of "error". This suggests that perhaps the module wasn't allowed to be registered in the first place (i.e. the exception was thrown in ResourceLoader::__construct or ::register?).

If that's the case, we could log from mw.loader.state instead.

The discoverability of these errors has been improved a lot by:

resourceloader: Write to debug log for all fatal errors
Bug: 44018
Change-Id: I684f6492f839a6c6adb07b0640e88cfea21fcf60

resourceloader: Consistently use 'resourceloader' log group
Bug: 44018
Change-Id: I9907b374fa868c04ff2ce40964238936b9084a4a

(In reply to comment #4)

The discoverability of these errors has been improved a lot by:

resourceloader: Write to debug log for all fatal errors
Bug: 44018
Change-Id: I684f6492f839a6c6adb07b0640e88cfea21fcf60

resourceloader: Consistently use 'resourceloader' log group
Bug: 44018
Change-Id: I9907b374fa868c04ff2ce40964238936b9084a4a

Good enough for me.