#include <stdio.h>#include "idl_export.h"#include "grpc.h"
Go to the source code of this file.
Functions | |
| IDL_VPTR | gs_error_string (int argc, IDL_VPTR *argv_idl) |
| IDL_VPTR | gs_get_last_error (int argc, IDL_VPTR *argv_idl) |
| IDL_VPTR gs_error_string | ( | int | argc, | |
| IDL_VPTR * | argv_idl | |||
| ) |
Implementation of gs_error_string() and gs_get_last_error(). These are routines for obtaining and printing error messages from GridRPC.
This is part of the IDL Client for GridSolve. Gets the GridRPC error message (string) corresponding to the specified error number.
| argc | -- the number of arguments | |
| argv_idl | -- the array of IDL arguments passed in. this should contain one argument: the error number to look up. |
Definition at line 28 of file gs_error.c.
{
grpc_error_t retval;
int status;
IDL_ENSURE_SCALAR(argv_idl[0]);
status = IDL_LongScalar(argv_idl[0]);
/* Initialize GridRPC system */
retval = grpc_initialize(NULL);
if((retval != GRPC_NO_ERROR) && (retval != GRPC_ALREADY_INITIALIZED)) {
IDL_Message(IDL_M_GENERIC, IDL_MSG_INFO, "Error: cannot initialize!");
return IDL_StrToSTRING("Init failed.");
}
return IDL_StrToSTRING(grpc_error_string((grpc_error_t)status));
}

| IDL_VPTR gs_get_last_error | ( | int | argc, | |
| IDL_VPTR * | argv_idl | |||
| ) |
Gets the last GridRPC error code that was generated. This includes successful calls, too.
| argc | -- the number of arguments | |
| argv_idl | -- the array of IDL arguments passed in. this should be empty. |
Definition at line 60 of file gs_error.c.
{
grpc_sessionid_t id;
grpc_error_t retval;
/* Initialize GridRPC system */
retval = grpc_initialize(NULL);
if((retval != GRPC_NO_ERROR) && (retval != GRPC_ALREADY_INITIALIZED)) {
IDL_Message(IDL_M_GENERIC, IDL_MSG_INFO, "Error: cannot initialize!");
return IDL_GettmpLong(retval);
}
if(grpc_get_failed_sessionid(&id) != GRPC_NO_ERROR) {
IDL_Message(IDL_M_GENERIC, IDL_MSG_INFO,
"Error: could not get last failed session ID.");
return IDL_GettmpLong(0);
}
return IDL_GettmpLong(grpc_get_error(id));
}


1.6.3-20100507