From 8f1ad519dd5ae1d17f625044bf18c3d8e77acea5 Mon Sep 17 00:00:00 2001 From: Tomas Bzatek Date: Fri, 5 Feb 2010 14:47:59 +0100 Subject: Report exceptions coming from VFS --- UError.pas | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'UError.pas') diff --git a/UError.pas b/UError.pas index 57250a8..6734367 100644 --- a/UError.pas +++ b/UError.pas @@ -21,7 +21,7 @@ unit UError; interface -uses glib2, gtk2, Classes, ULibc, GTKForms; +uses glib2, gtk2, Classes, SysUtils, ULibc, GTKForms; // Ported from gioerror.h @@ -68,11 +68,13 @@ function G_IO_ERROR: TGQuark; function g_io_error_from_errno(err_no: gint): GIOErrorEnum; +procedure g_set_error_from_exception(Error: PPGError; E: Exception); + procedure ShowError(Parent: TCustomGTKForm; const Text: string; Error: PGError); implementation -uses SysUtils, UCoreUtils, UGnome; +uses UCoreUtils, UGnome; (********************************************************************************************************************************) @@ -114,6 +116,12 @@ begin end; +(********************************************************************************************************************************) +procedure g_set_error_from_exception(Error: PPGError; E: Exception); +begin + g_set_error(Error, G_IO_ERROR, integer(G_IO_ERROR_FAILED), 'Exception raised: %s', PChar(E.Message)); +end; + (********************************************************************************************************************************) procedure ShowError(Parent: TCustomGTKForm; const Text: string; Error: PGError); var Dialog: PGtkWidget; -- cgit v1.2.3