Skip to content

Commit a308d36

Browse files
committed
datMsg: Indicate token is undefined if an error occurs.
Previously, if an error occurred getting the path for a locator the message token would be left with the value it had on entry to datMsg. This causes misleading error messages. So now, if an error occurs getting the path for the locator, set the token value to "^<token name>", which is the standard way to indicate that a message token has no defined value.
1 parent 8fd645c commit a308d36

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

datMsg.c

+6-3
Original file line numberDiff line numberDiff line change
@@ -230,8 +230,11 @@ void datMsg( const char * token, const HDSLoc * loc ) {
230230
if ( status != SAI__OK ) emsAnnul( &status );
231231
emsRlse();
232232

233-
/* If no error occurred, then assign the resulting buffer contents to
234-
* the message token. */
235-
if (ok) emsSetc( token, buff );
233+
/* If an error has occurred, set the token value to indicate the token
234+
is undefined. */
235+
if( !ok ) sprintf( buff, "^<%s>", token );
236+
237+
/* Assign the resulting buffer contents to the message token. */
238+
emsSetc( token, buff );
236239

237240
}

0 commit comments

Comments
 (0)