https://bugzilla.wikimedia.org/show_bug.cgi?id=59858

       Web browser: ---
            Bug ID: 59858
           Summary: Difficult to debug LESS compilation errors
           Product: MediaWiki
           Version: unspecified
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: Unprioritized
         Component: ResourceLoader
          Assignee: wikibugs-l@lists.wikimedia.org
          Reporter: santhosh.thottin...@gmail.com
                CC: krinklem...@gmail.com, roan.katt...@gmail.com,
                    tpars...@wikimedia.org
    Classification: Unclassified
   Mobile Platform: ---

If there is a compilation error with the less files, the only exception we get
is 

Warning: array_map(): An error occurred while invoking the map callback in
/home/santhosh/dev/wiki/core/includes/resourceloader/ResourceLoaderFileModule.php

This is not helpful. Because array maps cannot properly report errors from
callbacks.

Roan already reported this issue at PHP with a patch.
https://bugs.php.net/bug.php?id=55416 but not accepted at upstream.

Can't we modify the code in readStyleFiles of ResourceLoaderFileModule a bit so
that we get sensible stack trace and saves time in debugging?

instead of array map, it can be something like

$style= "";
foreach ( $files as $file  ) {
  $style = $style . "\n".  $this->readStyleFile( $file,  $flip );
}
$styles[$media] = $style;

What I expect is a helpful error message like:

exception 'Exception' with message '.mw-ui-one-third is undefined: failed at
`.mw-ui-one-third;`
/home/santhosh/dev/wiki/ContentTranslation/modules/base/styles/base.less on
line 27' in /home/santhosh/dev/wiki/core/includes/libs/lessc.inc.php:3527

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are on the CC list for the bug.
_______________________________________________
Wikibugs-l mailing list
Wikibugs-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to