Wiki source for KeyPgErfn


Show raw source

{{fbdoc item="title" value="ERFN"}}----
Error reporting function

{{fbdoc item="syntax"}}##
[[KeyPgDeclare|declare]] [[KeyPgFunction|function]] **Erfn** ( ) [[KeyPgAs|as]] [[KeyPgZstring|zstring]] [[KeyPgPtr|ptr]]
##
{{fbdoc item="usage"}}##
//result// = **Erfn** ( )
##
{{fbdoc item="ret"}}
Returns a pointer to the string identifying the function where the error occurred.

Returns NULL if the source is not compiled with the //[[CompilerOptexx|-exx]]// compiler option.

{{fbdoc item="desc"}}
An error reporting function returning a pointer to the name of the function.

{{fbdoc item="ex"}}
{{fbdoc item="filename" value="examples/manual/error/erfn.bas"}}%%(freebasic)
'' test.bas
'' compile with fbc -exx -lang fblite test.bas

#lang "fblite"

Sub Generate_Error
On Error Goto Handler
Error 1000
Exit Sub
Handler:
Print "Error Function: "; *Erfn()
Print "Error Module : "; *Ermn()
Resume Next
End Sub

Generate_Error
%%
**Output:**
%%Error Function: GENERATE_ERROR
Error Module : test.bas
%%


{{fbdoc item="lang"}}
- Not available in the //[[CompilerOptlang|-lang qb]]// dialect unless referenced with the alias ##**""__Erfn""**##.

{{fbdoc item="diff"}}
- New to ""FreeBASIC""

{{fbdoc item="see"}}
- ##[[KeyPgErl|Erl]]##
- ##[[KeyPgErmn|Ermn]]##
- ##[[KeyPgOnerror|On...Error]]##

{{fbdoc item="back" value="CatPgError|Error Handling Functions"}}
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki



sf.net phatcode