Add more error/debug messages

This commit is contained in:
Shahram Najm 2014-04-24 17:48:24 +01:00
parent bf875501ad
commit a87f541632
2 changed files with 8 additions and 1 deletions

View File

@ -259,7 +259,7 @@ grib_handle* grib_handle_new_from_samples ( grib_context* c, const char* name )
g=grib_external_template ( c,name );
if ( !g )
grib_context_log ( c,GRIB_LOG_ERROR,"Unable to locate sample file %s.tmpl\n in %s",
grib_context_log ( c,GRIB_LOG_ERROR,"Unable to load sample file %s.tmpl\n in %s",
name, c->grib_samples_path );
return g;

View File

@ -48,6 +48,10 @@ static grib_handle* try_template(grib_context* c,const char* dir,const char* nam
sprintf(path,"%s/%s.tmpl",dir,name);
if (c->debug==-1) {
printf("GRIB_API DEBUG: try_template path='%s'\n", path);
}
if(access(path,F_OK) == 0)
{
FILE* f = fopen(path,"r");
@ -57,6 +61,9 @@ static grib_handle* try_template(grib_context* c,const char* dir,const char* nam
return NULL;
}
g = grib_handle_new_from_file(c,f,&err);
if (!g) {
grib_context_log(c,GRIB_LOG_ERROR,"cannot create GRIB handle from %s",path);
}
fclose(f);
}