PreviousNext
Help > API Functions > Error management > i5_error
i5_error

 

 Retrieves error information for last action that was executed.

 

bool i5_error ([resource connection] )

 

Parameters

 

connection

Connection – result of i5_connect

 

Return

 

This is the function that allows error detailed analysis. It returns an associative indexed four elements table:

 

num

0

error number, same in i5_errno()

cat

1

error category

msg

2

Error message, as in i5_errormsg()

desc

3

Detailed description of the error

 

Message and description are related to error category:

 

I5_CAT_SQL

SQL engine error

SQL digital code included in number (i.e., 501)

SQL message included in message (i.e., SQL0501)

I5_CAT_SIGNAL

Error from system signal (file not found) then message contains CPFxxxx code

I5_CAT_MULTIREC

Error with multiple recording

(All records could not be written)

then message contains CPFxxxx code

Description contains a text telling how many records were really written.

I5_CAT_APPC

APPC communication error

Number contains primary code.

Description contains the text "APPC error primary xxxx secondary yyyy"

I5_CAT_INTERNAL

Easycom internal error
(i.e. license problem)

I5_CAT_TCPIP

TPC/IP communication error

I5_CAT_UNKNOWN

Unknown error

I5_CAT_VBA

Error in eac32vba library

I5_CAT_PHP

Easycom For PHP use error

 

 

Example

 

/* Connection test */

$conn = i5_connect('NOT_EXIST','user','password');

if ($conn == FALSE) {

$err = i5_error();

print_r($err);echo '<BR>';

switch  ($err["cat"]) {

case I5_CAT_TCPIP:

echo ' TCP/IP problem - Connection not possible ';

break;

case I5_CAT_INTERNAL:

echo ' Easycom error - Connection not possible ';

break;

echo 'Error number :'. i5_errno() . '<BR>';

echo 'Error message :'. i5_errormsg() .'<BR>';

}

 

$conn = i5_connect('p520', 'QPGMR', 'LAUNCHER');

if ($conn == FALSE) {

$err = i5_error();

print_r($err);echo '<BR>';

switch  ($err["cat"]) {

 case I5_CAT_TCPIP:

echo ' TCP/IP problem - Connection not possible ';

break;

 case I5_CAT_INTERNAL:

echo ' Easycom error - Connection not possible ';

break;

echo 'Error number :'. i5_errno() . '<BR>';

echo 'Error message :'. i5_errormsg() .'<BR>';

}

echo "Connected : $conn<BR>";

 

 

$file = i5_open('EASYCOM/NCLIENT', I5_OPEN_READ);

if (is_bool($file)) trigger_error('i5_open error : '.i5_errormsg(), E_USER_ERROR);

/* testing file edition */

$edition = i5_edit($file);

if ($edition == FALSE) {

switch  (i5_errno()) {

case I5_ERR_INVALIDOPENMODE:

 echo 'Opening a file in writing to enable modification<BR>';

 break;

 

case I5_ERR_RECORDNOTFOUND:

 echo 'Pointing a record before modification<BR>';

 break;

 

case I5_ERR_RECORDLOCKED:

 echo 'Locked record...<BR>';

 break;

}

 

/* SLQ request test */

$query = i5_query("SELECT * FROM EASYCOM/NOT_EXIST");

If ($query == FALSE){

 $error = i5_error();

 echo 'SQL error code: ' . i5_errno() . '<br>';

 echo 'Error message: ' . i5_errormsg() . '<br>';

 echo 'Error information: ';print_r($error);echo '<BR>';

 

}

 

See also

 

i5_errno

i5_errormsg

List of errors

Error category