From df63542510b6912405f3709b204ad3a59548c917 Mon Sep 17 00:00:00 2001 From: Jedidiah Barber Date: Sun, 1 Dec 2024 13:34:58 +1300 Subject: Improved specificity of exceptions with Internal_FLTK_Error and Storage_Error --- src/fltk-text_buffers.adb | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'src/fltk-text_buffers.adb') diff --git a/src/fltk-text_buffers.adb b/src/fltk-text_buffers.adb index 5d88b10..1afa2a7 100644 --- a/src/fltk-text_buffers.adb +++ b/src/fltk-text_buffers.adb @@ -24,6 +24,14 @@ use type package body FLTK.Text_Buffers is + function strerror + (Errnum : in Interfaces.C.int) + return Interfaces.C.Strings.chars_ptr; + pragma Import (C, strerror, "strerror"); + + + + function new_fl_text_buffer (RS, PGS : in Interfaces.C.int) return Storage.Integer_Address; @@ -634,7 +642,7 @@ package body FLTK.Text_Buffers is Interfaces.C.int (Buffer)); begin if Err_No /= 0 then - raise Storage_Error; + raise Storage_Error with Interfaces.C.Strings.Value (strerror (Err_No)); end if; end Load_File; @@ -650,7 +658,7 @@ package body FLTK.Text_Buffers is Interfaces.C.int (Buffer)); begin if Err_No /= 0 then - raise Storage_Error; + raise Storage_Error with Interfaces.C.Strings.Value (strerror (Err_No)); end if; end Append_File; @@ -668,7 +676,7 @@ package body FLTK.Text_Buffers is Interfaces.C.int (Buffer)); begin if Err_No /= 0 then - raise Storage_Error; + raise Storage_Error with Interfaces.C.Strings.Value (strerror (Err_No)); end if; end Insert_File; @@ -687,7 +695,7 @@ package body FLTK.Text_Buffers is Interfaces.C.int (Buffer)); begin if Err_No /= 0 then - raise Storage_Error; + raise Storage_Error with Interfaces.C.Strings.Value (strerror (Err_No)); end if; end Output_File; @@ -703,7 +711,7 @@ package body FLTK.Text_Buffers is Interfaces.C.int (Buffer)); begin if Err_No /= 0 then - raise Storage_Error; + raise Storage_Error with Interfaces.C.Strings.Value (strerror (Err_No)); end if; end Save_File; -- cgit