Revision history for KeyPgErr


Revision [21568]

Last edited on 2016-08-15 13:46:36 by fxm [ImageCreate() doesn't return an error code of course, because it returns the image pointer or NULL.]
Additions:
That is the case for: ##[[KeyPgBload|Bload]]##, ##[[KeyPgBsave|Bsave]]##, ##[[KeyPgClose|Close]]##, ##[[KeyPgFilecopy|FileCopy]]##, ##[[KeyPgGetjoystick|GetJoystick]]##, ##[[KeyPgGetmouse|GetMouse]]##, ##[[KeyPgImageInfo|ImageInfo]]##, ##[[KeyPgKill|Kill]]##, ##[[KeyPgOpen|Open]]##, ##[[KeyPgOpenCom|Open Com]]##, ##[[KeyPgOpenCons|Open Cons]]##, ##[[KeyPgOpenErr|Open Err]]##, ##[[KeyPgOpenLpt|Open Lpt]]##, ##[[KeyPgOpenPipe|Open Pipe]]##, ##[[KeyPgOpenScrn|Open Scrn]]##, ##[[KeyPgScreenres|ScreenRes]]##, ##[[KeyPgScreensync|ScreenSync]]##, ##[[KeyPgSetdate|SetDate]]##, ##[[KeyPgSetmouse|SetMouse]]##, ##[[KeyPgSettime|SetTime]]##.
Deletions:
That is the case for: ##[[KeyPgBload|Bload]]##, ##[[KeyPgBsave|Bsave]]##, ##[[KeyPgClose|Close]]##, ##[[KeyPgFilecopy|FileCopy]]##, ##[[KeyPgGetjoystick|GetJoystick]]##, ##[[KeyPgGetmouse|GetMouse]]##, ##[[KeyPgImagecreate|ImageCreate]]##, ##[[KeyPgImageInfo|ImageInfo]]##, ##[[KeyPgKill|Kill]]##, ##[[KeyPgOpen|Open]]##, ##[[KeyPgOpenCom|Open Com]]##, ##[[KeyPgOpenCons|Open Cons]]##, ##[[KeyPgOpenErr|Open Err]]##, ##[[KeyPgOpenLpt|Open Lpt]]##, ##[[KeyPgOpenPipe|Open Pipe]]##, ##[[KeyPgOpenScrn|Open Scrn]]##, ##[[KeyPgScreenres|ScreenRes]]##, ##[[KeyPgScreensync|ScreenSync]]##, ##[[KeyPgSetdate|SetDate]]##, ##[[KeyPgSetmouse|SetMouse]]##, ##[[KeyPgSettime|SetTime]]##.


Revision [21550]

Edited on 2016-08-14 04:00:38 by fxm [Added the list of procedures which return directly the error code when they are used in their function versions]
Additions:
Remark: Some procedures used in their function version return directly the error code (a 32 bit ##[[KeyPgLong|Long]]##).
That is the case for: ##[[KeyPgBload|Bload]]##, ##[[KeyPgBsave|Bsave]]##, ##[[KeyPgClose|Close]]##, ##[[KeyPgFilecopy|FileCopy]]##, ##[[KeyPgGetjoystick|GetJoystick]]##, ##[[KeyPgGetmouse|GetMouse]]##, ##[[KeyPgImagecreate|ImageCreate]]##, ##[[KeyPgImageInfo|ImageInfo]]##, ##[[KeyPgKill|Kill]]##, ##[[KeyPgOpen|Open]]##, ##[[KeyPgOpenCom|Open Com]]##, ##[[KeyPgOpenCons|Open Cons]]##, ##[[KeyPgOpenErr|Open Err]]##, ##[[KeyPgOpenLpt|Open Lpt]]##, ##[[KeyPgOpenPipe|Open Pipe]]##, ##[[KeyPgOpenScrn|Open Scrn]]##, ##[[KeyPgScreenres|ScreenRes]]##, ##[[KeyPgScreensync|ScreenSync]]##, ##[[KeyPgSetdate|SetDate]]##, ##[[KeyPgSetmouse|SetMouse]]##, ##[[KeyPgSettime|SetTime]]##.


Revision [21305]

Edited on 2016-04-03 16:10:45 by fxm [Err() returns a 32 bit Long]
Additions:
The ##**Err()**## function returns the ""FreeBASIC"" run-time error number (a 32 bit ##[[KeyPgLong|Long]]##) which can be set by the built-in statements and functions, or by the program through ##**Err = //number//**## or ##[[KeyPgError|Error]]##. Unlike ##[[KeyPgError|Error]]##, ##**Err = //number//**## sets the error number without invoking an error handler.
Deletions:
The ##**Err()**## function returns the ""FreeBASIC"" run-time error number which can be set by the built-in statements and functions, or by the program through ##**Err = //number//**## or ##[[KeyPgError|Error]]##. Unlike ##[[KeyPgError|Error]]##, ##**Err = //number//**## sets the error number without invoking an error handler.


Revision [20225]

Edited on 2016-02-10 15:59:53 by DkLwikki [Update link format]
Additions:
The ##**Err()**## function returns the ""FreeBASIC"" run-time error number which can be set by the built-in statements and functions, or by the program through ##**Err = //number//**## or ##[[KeyPgError|Error]]##. Unlike ##[[KeyPgError|Error]]##, ##**Err = //number//**## sets the error number without invoking an error handler.
See [[TblRuntimeErrors|Runtime Error Codes]] for a listing of the predefined runtime error numbers and their associated meaning. The program may use additional custom error numbers.
##**Err**## can always be used, even if QB-like error handling is not enabled. ##**Err**## is reset by ##[[KeyPgResume|Resume]]## and ##[[KeyPgResumenext|Resume Next]]##.
Note: Care should be taken when calling an internal function (such as ##[[KeyPgPrint|Print]]##) after an error occurred, because it will reset the error value with its own error status. To preserve the ##**Err**## value, it is a good idea to store it in a variable as soon as the error handler is entered.
An example using inline error handling (note: ##[[KeyPgOpen|Open]]## can also return its own error status when called as a function)
- ##[[KeyPgOnerror|On Error]]##
- ##[[KeyPgError|Error]]##
- [[ProPgErrorHandling|Error Handling]]
- [[TblRuntimeErrors|Runtime Error Codes]]
Deletions:
The ##**Err()**## function returns the ""FreeBASIC"" run-time error number which can be set by the built-in statements and functions, or by the program through ##**Err = //number//**## or ##[[KeyPgError Error]]##. Unlike ##[[KeyPgError Error]]##, ##**Err = //number//**## sets the error number without invoking an error handler.
See [[TblRuntimeErrors Runtime Error Codes]] for a listing of the predefined runtime error numbers and their associated meaning. The program may use additional custom error numbers.
##**Err**## can always be used, even if QB-like error handling is not enabled. ##**Err**## is reset by ##[[KeyPgResume Resume]]## and ##[[KeyPgResumenext Resume Next]]##.
Note: Care should be taken when calling an internal function (such as ##[[KeyPgPrint Print]]##) after an error occurred, because it will reset the error value with its own error status. To preserve the ##**Err**## value, it is a good idea to store it in a variable as soon as the error handler is entered.
An example using inline error handling (note: ##[[KeyPgOpen Open]]## can also return its own error status when called as a function)
- ##[[KeyPgOnerror On Error]]##
- ##[[KeyPgError Error]]##
- [[ProPgErrorHandling Error Handling]]
- [[TblRuntimeErrors Runtime Error Codes]]


Revision [16151]

Edited on 2012-03-30 19:46:50 by DkLwikki [Document the Err = number syntax]
Additions:
The ##**Err()**## function returns the ""FreeBASIC"" run-time error number which can be set by the built-in statements and functions, or by the program through ##**Err = //number//**## or ##[[KeyPgError Error]]##. Unlike ##[[KeyPgError Error]]##, ##**Err = //number//**## sets the error number without invoking an error handler.
See [[TblRuntimeErrors Runtime Error Codes]] for a listing of the predefined runtime error numbers and their associated meaning. The program may use additional custom error numbers.
Deletions:
The ##**Err()**## function returns the ""FreeBASIC"" run-time error number which can be set by the built-in statements and functions, or by the program through ##**Err = //number//**## or ##[[KeyPgError Error]]##. Unlike ##[[KeyPgError Error]]##, ##**Err = //number//**## sets the error number without invoking an error handler. See [[TblRuntimeErrors Runtime Error Codes]] for a listing of the predefined runtime error numbers and their associated meaning. The program may use additional custom error numbers.


Revision [16150]

Edited on 2012-03-30 19:45:59 by DkLwikki [Document the <Err = number> syntax]
Additions:
Get or set the run-time error number
//result// = **Err**( )
//or//
**Err** = //number//
The ##**Err()**## function returns the ""FreeBASIC"" run-time error number which can be set by the built-in statements and functions, or by the program through ##**Err = //number//**## or ##[[KeyPgError Error]]##. Unlike ##[[KeyPgError Error]]##, ##**Err = //number//**## sets the error number without invoking an error handler. See [[TblRuntimeErrors Runtime Error Codes]] for a listing of the predefined runtime error numbers and their associated meaning. The program may use additional custom error numbers.

##**Err**## can always be used, even if QB-like error handling is not enabled. ##**Err**## is reset by ##[[KeyPgResume Resume]]## and ##[[KeyPgResumenext Resume Next]]##.

Note: Care should be taken when calling an internal function (such as ##[[KeyPgPrint Print]]##) after an error occurred, because it will reset the error value with its own error status. To preserve the ##**Err**## value, it is a good idea to store it in a variable as soon as the error handler is entered.
- ##[[KeyPgError Error]]##
- [[ProPgErrorHandling Error Handling]]
Deletions:
Error handling function to return the error number of the last error
{{fbdoc item="syntax"}}##
[[KeyPgDeclare declare]] [[KeyPgFunction function]] **Err** ( ) [[KeyPgAs as]] [[KeyPgInteger integer]]
//result// = **Err**
{{fbdoc item="ret"}}
After an error, returns the error code that occurred.
##**Err**## can always be used, even if QB-like error handling is not enabled.
##**Err**## is reset by ##[[KeyPgResume Resume]]## and ##[[KeyPgResumenext Resume Next]]##.
NOTE: Care should be taken when calling an internal function (such as ##[[KeyPgPrint Print]]##) after an error occurs because it will reset the error value with its own error status. To preserve the ##**Err**## value, it is a good idea to store it in a variable as soon as the error handler is entered.
See [[TblRuntimeErrors Runtime Error Codes]] for a listing of runtime error numbers and their associated meaning.
- {{fbdoc item="keyword" value="ProPgErrorHandling|Error Handling"}}


Revision [15056]

Edited on 2011-03-20 19:00:05 by CountingPine [Document the <Err = number> syntax]
Additions:
NOTE: Care should be taken when calling an internal function (such as ##[[KeyPgPrint Print]]##) after an error occurs because it will reset the error value with its own error status. To preserve the ##**Err**## value, it is a good idea to store it in a variable as soon as the error handler is entered.
n = Err()
An example using inline error handling (note: ##[[KeyPgOpen Open]]## can also return its own error status when called as a function)
'' compile without -e switch
dim filename as string
line input "Input filename: ", filename
if filename = "" then end
open filename for input as #1
loop until err() = 0
print using "File '&' opened successfully"; filename
Deletions:
NOTE: Calling ##[[KeyPgPrint Print]]## after an error occurs clears the error value; ##[[KeyPgPrint Print]] **Err**## will always return 0. To print the error value, ##**Err**## should be first copied to an auxiliary variable.
n = Err
An example using inline error handling
dim a as string
line input "Input filename: ", a
if a = "" then end
open a for input as #1
loop until err = 0
print "File " & a & " opened successfully"


Revision [15054]

Edited on 2011-03-20 18:46:05 by CountingPine [Document the <Err = number> syntax]
Additions:
NOTE: Calling ##[[KeyPgPrint Print]]## after an error occurs clears the error value; ##[[KeyPgPrint Print]] **Err**## will always return 0. To print the error value, ##**Err**## should be first copied to an auxiliary variable.
Deletions:
NOTE: Calling ##[[KeyPgPrint Print]]## after an error occurrs clears the error value; ##[[KeyPgPrint Print]] **Err**## will always return 0. To print the error value, ##**Err**## should be first copied to an auxiliary variable.


Revision [15053]

Edited on 2011-03-19 01:36:59 by AgAmemnus [wrong tense!]
Additions:
NOTE: Calling ##[[KeyPgPrint Print]]## after an error occurrs clears the error value; ##[[KeyPgPrint Print]] **Err**## will always return 0. To print the error value, ##**Err**## should be first copied to an auxiliary variable.
Deletions:
NOTE: Calling ##[[KeyPgPrint Print]]## after an error occurred clears the error value; ##[[KeyPgPrint Print]] **Err**## will always return 0. To print the error value, ##**Err**## should be first copied to an auxiliary variable.


Revision [15051]

Edited on 2011-03-19 01:36:01 by AgAmemnus [standardizing my text...]
Additions:
NOTE: Calling ##[[KeyPgPrint Print]]## after an error occurred clears the error value; ##[[KeyPgPrint Print]] **Err**## will always return 0. To print the error value, ##**Err**## should be first copied to an auxiliary variable.
Deletions:
NOTE: Calling ##[[KeyPgPrint "print"]] after an error occurred clears the error value; ##[[KeyPgPrint "print]]## ##**err**##" will always return 0. To print the error value, ##**err**## should be first copied to an auxiliary variable.


Revision [15048]

Edited on 2011-03-19 01:28:23 by AgAmemnus [A clearer explanation of print clearing err value.]
Additions:
NOTE: Calling ##[[KeyPgPrint "print"]] after an error occurred clears the error value; ##[[KeyPgPrint "print]]## ##**err**##" will always return 0. To print the error value, ##**err**## should be first copied to an auxiliary variable.
Deletions:
NOTE: ##[[KeyPgPrint Print]] **Err**## after an error occurred may end up printing ##0##, because ##[[KeyPgPrint Print]]## sets a new ##**Err**## value when executed. To print an ##**Err**## value it should be first copied to an auxiliary variable and print that one.


Revision [14132]

Edited on 2009-04-26 22:46:10 by CountingPine [A clearer explanation of print clearing err value.]
Additions:
NOTE: ##[[KeyPgPrint Print]] **Err**## after an error occurred may end up printing ##0##, because ##[[KeyPgPrint Print]]## sets a new ##**Err**## value when executed. To print an ##**Err**## value it should be first copied to an auxiliary variable and print that one.
line input "Input filename: ", a
if a = "" then end
open a for input as #1
loop until err = 0
print "File " & a & " opened successfully"
close #1
Deletions:
NOTE: PRINT ERR after an error occurred is likely to print 0, because PRINT sets a new ERR value when executed. To print an ERR value it must be first copied to an auxiliary variable and print that one.
input "Input filename ";a
if a="" then exit do
open a for input as #1
loop until err=0


Revision [13563]

Edited on 2008-07-21 15:43:48 by JeffMarshall [added #lang or $lang to example]
Additions:
#lang "fblite"
On Error Goto Error_Handler
Error 150
End
Print "Error #"; n
Resume Next
Deletions:
on error goto Error_Handler
error 150
end
print "Error #"; n
resume next


Revision [13242]

The oldest known version of this page was created on 2008-04-26 09:11:00 by JeffMarshall [added #lang or $lang to example]
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki



sf.net phatcode