mirror of https://github.com/ecmwf/eccodes.git
Add more error/debug messages
This commit is contained in:
parent
bf875501ad
commit
a87f541632
|
@ -259,7 +259,7 @@ grib_handle* grib_handle_new_from_samples ( grib_context* c, const char* name )
|
||||||
|
|
||||||
g=grib_external_template ( c,name );
|
g=grib_external_template ( c,name );
|
||||||
if ( !g )
|
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 );
|
name, c->grib_samples_path );
|
||||||
|
|
||||||
return g;
|
return g;
|
||||||
|
|
|
@ -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);
|
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)
|
if(access(path,F_OK) == 0)
|
||||||
{
|
{
|
||||||
FILE* f = fopen(path,"r");
|
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;
|
return NULL;
|
||||||
}
|
}
|
||||||
g = grib_handle_new_from_file(c,f,&err);
|
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);
|
fclose(f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue