Jasa Pembuatan Aplikasi Murah Berkualitas
konsultasi gratis sekarang

Troubleshooting Joomla: An error has occurred.

Published on Saturday, Mar 15, 2014

As you know Joomla has a bad error reporting. One of the most frustrating error message is ‘An error has occurred.’ followed by some error code like 1146. In this tutorial we will update Joomla’s core file so that it will show a more informative error messages instead of just error code.

We will modify the execute function of JControllerLegacy class, its in /joomlapath/libraries/legacy/controller/legacy.php on Joomla 3.2.x. In this function we will add an exception handling code so that it will display php stack trace when an exception has occurred.

 * Execute a task by triggering a method in the derived class.
 * @param   string  $task  The task to perform. If no matching task is found, the '__default' task is executed, if defined.
 * @return  mixed   The value returned by the called method, false in error case.
 * @since   12.2
 * @throws  Exception
public function execute($task)
	$this->task = $task;

	$task = strtolower($task);
	if (isset($this->taskMap[$task]))
		$doTask = $this->taskMap[$task];
	elseif (isset($this->taskMap['__default']))
		$doTask = $this->taskMap['__default'];
		throw new Exception(JText::sprintf('JLIB_APPLICATION_ERROR_TASK_NOT_FOUND', $task), 404);

	// Record the actual task being fired
	$this->doTask = $doTask;
		return $this->$doTask();
	}catch(Exception $e){			
		echo 'Exception:'. $e->getMessage();