Summary: Create a way to throw Warnings and Errors with proper
           Product: MediaWiki
           Version: 1.18-svn
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: Normal
         Component: Resource Loader

If a native javascript method fails (eg. calling a member as a function on a
non-object) there's an error thrown:

  TypeError: Result of expression 'f.test' [undefined] is not a function. 

But when a custom error is thrown (ie. "MediaWiki DeprecatedWarning: Function
mw.legacy.sajax_init_object is deprecated" ) it will report no file/line number
to the console or in some cases the filename and line number where the throw
originates from, not where the function was called.

So the goal of this bug is to end up with something like:

-- short wrappers to avoid doing any throws directly in the code (would use or
do something like jQuery.error )
* mw.log (what it is now, simple dummy in production and console.log or
mw.console in debug for logging messages)
* mw.log.error and mw.log.warning for throwing stuff
* mw.log.deprecated calls mw.log.warning with some magic stuff to know what was
called and where it comes from

-- example of where it is defined
mw.legacy.sajax_init_object : function() {

 /* stuff */


-- example of where it would be triggered
function myGadget(){
  var path = '...';
  var xhttp = mw.legacy.sajax_init_object()
  /* etc. stuff */
  var foobar = getStuff();
  mw.util.addPortletLink( foobar );

-- example of console output
{X} MWDeprecatedWarning: Use of sajax_init_object is deprecated [mygadget.js:3]
{X} MWSyntaxError: addPortletLink requires at least 3 arguments, 2 given

Links of interest:


Configure bugmail:
------- You are receiving this mail because: -------
You are on the CC list for the bug.

Wikibugs-l mailing list

Reply via email to