← Back to team overview

mahara-contributors team mailing list archive

[Bug 1393259] Re: Rethink Mahara exceptions handling to be more modern/best practice

 

** Changed in: mahara
       Status: New => Triaged

-- 
You received this bug notification because you are a member of Mahara
Contributors, which is subscribed to Mahara.
Matching subscriptions: Subscription for all Mahara Contributors -- please ask on #mahara-dev or mahara.org forum before editing or unsubscribing it!
https://bugs.launchpad.net/bugs/1393259

Title:
  Rethink Mahara exceptions handling to be more modern/best practice

Status in Mahara ePortfolio:
  Triaged

Bug description:
  Mahara seems to be using a strange approach to handle errors and
  exceptions but overriding handlers.

  See lib/errors.php

  $errorlevel = E_ALL & ~E_STRICT;
  error_reporting($errorlevel);
  set_error_handler('error', $errorlevel);
  set_exception_handler('exception');

  I am not sure it's the best approach since it creates problems with
  catching exceptions and working with Unit Tests, especially when
  external libraries are expecting standard methods of handling errors
  and exceptions.

  For example, I was trying to add a library to Mahara today which uses
  trigger_error() and @expectedException, but the way Mahara handles
  error, tests simply don't work...

  Was talking to Robert today and from his words:

  "We might want to rethink our exception handling, I'm just reading
  this article  -> http://ralphschindler.com/2010/09/15/exception-best-
  practices-in-php-5-3 "

To manage notifications about this bug go to:
https://bugs.launchpad.net/mahara/+bug/1393259/+subscriptions


References