getmsg_c |
Table of contents
Proceduregetmsg_c ( Get Error Message ) void getmsg_c ( ConstSpiceChar * option, SpiceInt msglen, SpiceChar * msg ) AbstractRetrieve the current short error message, the explanation of the short error message, or the long error message. Required_ReadingERROR KeywordsERROR Brief_I/OVARIABLE I/O DESCRIPTION -------- --- -------------------------------------------------- option I Indicates type of error message. msglen I Available space in the output string `msg'. msg O The error message to be retrieved. Detailed_Inputoption is a string that indicates the type of error message to be retrieved. Possible values of `option' are: "SHORT" indicates that the short message is to be retrieved. "EXPLAIN" indicates that the explanation of the short message is to be retrieved. "LONG" indicates that the long message is to be retrieved. The input strings indicating the choice of option may be in mixed case. Leading and trailing blanks in `option' are not significant. msglen is the maximum allowed length of the output message string, including the terminating null character. For example, if the caller wishes to be able to accept an 1840-character message, `msglen' must be set to (at least) 1841. The current maximum long error message length is in fact 1840 characters. Detailed_Outputmsg is the error message to be retrieved. Its value depends on `option', and on whether an error condition exists. When there is no error condition, `msg' is empty. If an error condition does exist, and `option' is "SHORT" `msg' is the current short error message. This is a very condensed, 25-character description of the error. "EXPLAIN" `msg' is the explanation of the current short error message. This is a one-line expansion of the text of the short message. Most CSPICE short error messages have corresponding explanation text. For other short error messages, if there is no explanation text, `msg' will be blank. "LONG" `msg' is the current long error message. The long error message is a detailed explanation of the error, possibly containing data specific to the particular occurrence of the error. Not all errors have long error messages. If there is none, `msg' will be blank. Long error messages are no longer than 320 characters. If `option' is invalid, `msg' will remain unchanged from its value on input. ParametersNone. Exceptions1) If the input `option' is invalid, the error SPICE(INVALIDMSGTYPE) is signaled by a routine in the call tree of this routine. In that case no messages are returned; `msg' retains the value it had on input. 2) If the `option' input string pointer is null, the error SPICE(NULLPOINTER) is signaled. 3) If the `option' input string has zero length, the error SPICE(EMPTYSTRING) is signaled. 4) If the `msg' output string pointer is null, the error SPICE(NULLPOINTER) is signaled. 5) If the `msg' output string has length less than two characters, the error SPICE(STRINGTOOSHORT) is signaled, since the output string is too short to contain one character of output data plus a null terminator. FilesNone. ParticularsPlease read the "required reading" first! A good time to call this routine would be when an error condition exists, as indicated by the CSPICE function, failed_c. See the example below for a serving suggestion. getmsg_c isn't too useful if an error condition doesn't exist, since it will return a blank string in that case. ExamplesHere's an example of a real-life call to getmsg_c to get the explanation of the current short error message. In this example, a CSPICE routine, ckopn_c, is called. Following the return from ckopn_c, the logical function, failed_c, is tested to see whether an error occurred. If it did, the message is retrieved and output via a user-defined output routine: #include "SpiceUsr.h" #include <stdio.h> #define MSGLEN 1841 SpiceChar msg [ MSGLEN ]; . . . /. We call ckopn_c; then test for errors... ./ ckopn_c ( filename, ifname, ncomch, &handle ); if ( failed_c() ) { /. Get explanation text for the current short message and print it: ./ getmsg_c ( "EXPLAIN", MSGLEN, msg ); [Output message] . . . } RestrictionsNone. Literature_ReferencesNone. Author_and_InstitutionN.J. Bachman (JPL) J. Diaz del Rio (ODC Space) Version-CSPICE Version 1.1.0, 02-AUG-2021 (JDR) Changed the input argument "lenout" to "msglen" for consistency with other routines. Edited the header to comply with NAIF standard. -CSPICE Version 1.0.0, 05-APR-1999 (NJB) Index_Entriesget error message |
Fri Dec 31 18:41:07 2021