# Exception in Delphi - how to get the LineNo in Script?

**URL:** https://talk.remobjects.com/t/exception-in-delphi-how-to-get-the-lineno-in-script/9139
**Category:** Pascal Script
**Created:** [May 4, 2016, 8:46am UTC](https://talk.remobjects.com/t/exception-in-delphi-how-to-get-the-lineno-in-script/9139 "2016-05-04T08:46:09Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Klaus.Meier](https://talk.remobjects.com/letter_avatar_proxy/v4/letter/k/a5b964/32.png) [@Klaus.Meier](https://talk.remobjects.com/u/Klaus.Meier)
#### Post date: [May 4, 2016, 8:46am UTC](https://talk.remobjects.com/t/exception-in-delphi-how-to-get-the-lineno-in-script/9139/1 "2016-05-04T08:46:10Z")

</div>

Hello,  
one of my Delphi-Methods raises an Exception.  
Now I would like to know, which line is processed when the Exception comes up.

I found this code:  
_if Exec.ExceptionCode \<\> erNoError then \_  
\_ showmessage(’[Runtime Error] : ’ + TIFErrorToString(Exec.ExceptionCode, Exec.ExceptionString) +_  
\_ ’ in ’ + IntToStr(Exec.ExceptionProcNo) + ’ at ’ + IntToSTr(Exec.ExceptionPos));\_

But this did not help.

Thank you  
Klaus

---

<div class="post-metadata">

### Author: ![ck](https://talk.remobjects.com/user_avatar/talk.remobjects.com/ck/32/8740_2.png) [@ck](https://talk.remobjects.com/u/ck)
#### Post date: [May 4, 2016, 10:09am UTC](https://talk.remobjects.com/t/exception-in-delphi-how-to-get-the-lineno-in-script/9139/2 "2016-05-04T10:09:40Z")

</div>

There’s an On\*Line event, if you have debug info available it will trigger for every ran line and you can store the line to maintain the last line that ran before an exception.

---

<div class="post-metadata">

### Author: ![Klaus.Meier](https://talk.remobjects.com/letter_avatar_proxy/v4/letter/k/a5b964/32.png) [@Klaus.Meier](https://talk.remobjects.com/u/Klaus.Meier)
#### Post date: [May 9, 2016, 7:48am UTC](https://talk.remobjects.com/t/exception-in-delphi-how-to-get-the-lineno-in-script/9139/3 "2016-05-09T07:48:15Z")

</div>

Thank you Carlo,
