Here is a list of errors generated by template parser. Some of them are used only internally by parser and are not returned by the fits_execute_template() function.
Name Value Description
-------------------------------------------------------------------------
NGP_NO_MEMORY 360 malloc failed
NGP_READ_ERR 361 read error from file
NGP_NUL_PTR 362 null pointer passed as an argument.
Passing null pointer as a name of
template file raises this error
NGP_EMPTY_CURLINE 363 line read seems to be empty (used
internally)
NGP_UNREAD_QUEUE_FULL 364 cannot unread more then 1 line (or single
line twice)
NGP_INC_NESTING 365 too deep include file nesting (infinite
loop, template includes itself ?)
NGP_ERR_FOPEN 366 fopen() failed, cannot open template file
NGP_EOF 367 end of file encountered and not expected
NGP_BAD_ARG 368 bad arguments passed. Usually means
internal parser error. Should not happen
NGP_TOKEN_NOT_EXPECT 369 token not expected here
-------------------------------------------------------------------------
In general fits_execute_template() function tries to be as atomic as
possible, so either everything is done or nothing is done. If an error
occurs during parsing of the template, fits_execute_template() will (try to)
delete the top level BLOCK (with all its children if any) in which the error
occured, then it will stop reading the template file and it will return with
an error.