apidoc
[ class tree: apidoc ] [ index: apidoc ] [ all elements ]

Class: Gtk2_ExceptionDump

Source Location: /Gtk2_ExceptionDump-1.0.0/Gtk2/ExceptionDump.php

Class Overview

GtkWindow
   |
   --Gtk2_ExceptionDump

Displays an Exception in a GtkWindow.


Author(s):

Variables

Methods


Inherited Variables

Inherited Methods


Class Details

[line 27]
Displays an Exception in a GtkWindow.

Supports PHP Exceptions and PEAR_Error objects.

Simple example: $error = new PEAR_Error(); Gtk2_ExceptionDump::display($error);

Second example: Gtk2_ExceptionDump::setupExceptionHandler(); throw new Exception('Exception!');

Third example: Gtk2_ExceptionDump::setupPearErrorHandler(); PEAR::raiserError('Error!');

Fourth example: Gtk2_ExceptionDump::setupPhpErrorHandler(); trigger_error('Oops! A php error', E_USER_ERROR);



[ Top ]


Class Variables

$exception =  null

[line 34]

The exception that is shown.

PEAR_Error or Exception.

  • Access: protected

Type:   mixed


[ Top ]



Method Detail

__construct (Constructor)   [line 49]

Gtk2_ExceptionDump __construct( mixed $exception, [string $title = null])

Creates a new ExceptionDump window.

You still need to show it and run the main loop.

The window can be closed, quitting the main loop and continuing running the program OR quitting the script with exit status 253

  • Access: public

Parameters:

mixed   $exception   —  Exception or PEAR_Error object
string   $title   —  The title for the window

[ Top ]

buildActionButtonBox   [line 293]

GtkButtonBox buildActionButtonBox( )

Returns the box with the Copy button.
  • Return: The button box.
  • Access: protected

[ Top ]

buildContinuationButtonBox   [line 267]

GtkButtonBox buildContinuationButtonBox( )

Returns the box with the Execute/Continue buttons.
  • Return: The button box.
  • Access: protected

[ Top ]

buildDialog   [line 235]

void buildDialog( )

Creates the dialog widgets.
  • Access: protected

[ Top ]

buildError   [line 314]

void buildError( mixed $exception)

Creates the error message that the object isn't an Exception or a PEAR_Error.
  • Access: protected

Parameters:

mixed   $exception   —  Some variable that isn't an Exception or a PEAR_Error object

[ Top ]

display   [line 70]

void display( mixed $exception, [string $title = null])

Creates a new ExceptionDump window, displays it and starts its own main loop.

The window can be closed, quitting the main loop and continuing running the program OR quitting the script with exit status 253

  • Access: public

Parameters:

mixed   $exception   —  Exception or PEAR_Error object
string   $title   —  (optional) The title for the window

[ Top ]

getExceptionAsString   [line 373]

void getExceptionAsString( mixed $exception)

Generates a string representation of the exception.
  • Access: protected

Parameters:

mixed   $exception   —  The exception to convert

[ Top ]

handlePhpError   [line 154]

void handlePhpError( int $errno, string $errstr, [string $errfile = null], [int $errline = null], [array $errcontext = array()])

Use Gtk2_ExceptionDump to display a PHP error.
  • Access: public

Parameters:

int   $errno   —  Contains the level of the error raised
string   $errstr   —  Error message
string   $errfile   —  Filename that the error was raised in
int   $errline   —  Line number the error was raised at
array   $errcontext   —  Array that points to the active symbol table at the point the error occurred. In other words, errcontext will contain an array of every variable that existed in the scope the error was triggered in.

[ Top ]

onContinue   [line 346]

void onContinue( )

Closes the window, quits the main loop and continues normal script execution.
  • Access: public

[ Top ]

onCopy   [line 360]

void onCopy( )

Copies the exception/error as string to the clipboard.
  • Access: public

[ Top ]

onQuit   [line 335]

void onQuit( )

Quits the php script with exit status 253.
  • Access: public

[ Top ]

setException   [line 188]

void setException( mixed $exception, [ $title = null])

Set the exception object.
  • Access: public

Parameters:

mixed   $exception   —  The exception to display
   $title   — 

[ Top ]

setTitle   [line 209]

void setTitle( $exception, string $title)

Sets the title of the window.
  • Access: protected

Parameters:

string   $title   —  Window title to use
   $exception   — 

[ Top ]

setupAllHandlers   [line 132]

void setupAllHandlers( )

Sets up that all errors/exceptions are handled with Gtk2_ExceptionDump.

Calls setupExceptionHandler() and setupPearErrorHandler() internally.

  • Access: public

[ Top ]

setupExceptionHandler   [line 90]

void setupExceptionHandler( )

Sets up the PHP exception handler to call Gtk2_ExceptionDump::display() if an exception occurs.

This is the safest way to handle *all* uncaught exceptions with Gtk2_ExceptionDump. It handles "real" exceptions only, not PEAR_Errors.

Note that the "continue" button doesn't work anymore, since the exceptions are handled out of all user php code.

  • Access: public

[ Top ]

setupPearErrorHandler   [line 104]

void setupPearErrorHandler( )

Sets up the PEAR Exception handler to call Gtk2_ExceptionDump::display() if an PEAR_Error occurs.

While this catches *all* PEAR_Errors, it also catches the ones that are handled by php scripts.

  • Access: public

[ Top ]

setupPhpErrorHandler   [line 119]

void setupPhpErrorHandler( )

Sets the php error handler to use Gtk2_ExceptionDump.

All catchable PHP errors are displayed here.

Not all errors are handled, only the ones defined by error_reporting.

  • Access: public

[ Top ]


Documentation generated on Mon, 11 Mar 2019 14:55:21 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.