INCLERRORLINE: Difference between revisions

From QB64 Phoenix Edition Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 13: Line 13:




==Availability==
{{PageAvailability}}
* '''Version 1.1 and up'''.
* '''Version 1.1 and up'''.



Revision as of 01:59, 28 January 2023

The _INCLERRORFILE$ function returns the line number in an $INCLUDE file that caused the most recent error.


Syntax

errline& = _INCLERRORLINE


Description

  • If the last error occurred in the main module, _INCLERRORLINE returns 0.
  • By checking _INCLERRORLINE you can report exactly what line inside an included module caused the last error.


Availability

  • Version 1.1 and up.


Examples

Example:

ON ERROR GOTO DebugLine

ERROR 250 'simulated error code - an error in the main module leaves _INCLERRORLINE empty (= 0)

'$INCLUDE:'haserror.bi'

END

DebugLine:
PRINT "An error occurred. Please contact support with the following details:
PRINT "ERROR "; ERR; " ON LINE: "; _ERRORLINE
IF _INCLERRORLINE THEN
    PRINT "    IN MODULE "; _INCLERRORFILE$; " (line"; _INCLERRORLINE; ")"
END IF
RESUME NEXT
An error occurred. Please contact support with the following details:
ERROR  250  ON LINE:  6

An error occurred. Please contact support with the following details:
ERROR  250  ON LINE:  9
    IN MODULE haserror.bi ( line 1 )


See also



Navigation:
Main Page with Articles and Tutorials
Keyword Reference - Alphabetical
Keyword Reference - By usage
Report a broken link