Please enable JavaScript to view this site.

Navigation: Advanced topics > Programming topics > REST API Connections > RestConnection class > RestConnection Methods

lastError

Scroll Prev Next More

Returns last error message

Syntax

 

lastError()

 

Arguments

no arguments

Return value

 

string. text description of an error.

 

When the server returns an error, the message shows all data returned from the server, HTTP header and response body.

 

Example

 

dynamic rconn = null, request = null, result = null;
rconn = CommonFunctions.getRESTConn();
result = rconn.requestJSON( "/resource", "GET" );
if (!result) {
 MVCFunctions.Echo("Error occurred. Description: ");
       MVCFunctions.Echo(rconn.lastError());
} else {
 MVCFunctions.Echo("Request successful. Result: ");
 MVCFunctions.print_r(result);
}