Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6543843
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T11:23:40+00:00 2026-05-25T11:23:40+00:00

I was sure this used to work for me, and I’ve seen it out

  • 0

I was sure this used to work for me, and I’ve seen it out on the net (Jolyon Smith and David Moorhouse). Having just tried it in a simple program both in D2007 and in XE2 trial, it doesn’t keep the modified Message. As soon as the “raise” happens, the message reverts back to the original exception.

What blindlingly obvious thing am I missing ? The alternative is to “raise Exception.Create(…)” but I want to just propogate the original exception back up the chain, only with additional information tagged along at each exception block.

var a: Integer;
begin
  try
    a := 0;
    Label1.Caption := IntToStr(100 div a);
  except
    on e: Exception do
    begin
      e.Message := 'Extra Info Plus the original : ' + e.Message;
      raise;
    end;
  end;
end;
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T11:23:41+00:00Added an answer on May 25, 2026 at 11:23 am

    Well blow me! This looked so wrong that I had to try it myself, and you’re absolutely right! I’ve narrowed it down to the fact that this is an OS exception (divide by zero) that is generated by the OS itself and not by Delphi. If you try and raise an EIntError yourself you get the expected behaviour, and not what you see above. Note that expected behaviour occurs whenever you raise an exception yourself.

    Update: In the System.pas unit there is the following code called when the exception is re-raised:

    { Destroy any objects created for non-delphi exceptions }
    
    MOV     EAX,[EDX].TRaiseFrame.ExceptionRecord
    AND     [EAX].TExceptionRecord.ExceptionFlags,NOT cUnwinding
    CMP     [EAX].TExceptionRecord.ExceptionCode,cDelphiException
    JE      @@delphiException
    MOV     EAX,[EDX].TRaiseFrame.ExceptObject
    CALL    TObject.Free
    CALL    NotifyReRaise
    

    So if the exception is not a Delphi exception (in this case an OS exception) then the (modified) “Delphi” exception is freed and the original exception is re-raised, thereby throwing away any changes made to the exception. Case closed!

    Update 2: (couldn’t help myself). You can reproduce this with the following code:

    type
      TThreadNameInfo = record
        InfoType: LongWord;  // must be $00001000
        NamePtr: PAnsiChar;  // pointer to message (in user address space)
        ThreadId: LongWord;  // thread id ($ffffffff indicates caller thread)
        Flags: LongWord;     // reserved for future use, must be zero
      end;
    
    var
      lThreadNameInfo: TThreadNameInfo;
    
      with lThreadNameInfo do begin
        InfoType := $00001000;
        NamePtr := PAnsiChar(AnsiString('Division by zero'));
        ThreadId := $ffffffff;
        Flags := $00000000;
      end;
      RaiseException($C0000094, 0, sizeof(lThreadNameInfo) div sizeof(LongWord), @lThreadNameInfo);
    

    Have fun!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I can't work out what I'm doing wrong - I'm sure this used to
...at least to me. This code used to work fine. I'm pretty sure nothing
I'm not sure what I did, because this used to work fine, but all
I'm sure this was asked somewhere in another question, but the wording used there
I'm not sure this is possible, but is there a syntax to be used
I'm sure there used to be a plugin for this kinda stuff, but now
Wasn't quite sure how to word this but let's say I've used ssh to
Im sure this is pretty simple but I just cant seem to find the
This code used to work on Vista (and Windows XP) but after an upgrade
This used to work on the old server and I got the files backed

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.