mirror of https://github.com/ecmwf/eccodes.git
Error handling: Add a user-friendly error message
This commit is contained in:
parent
0eb43c66f5
commit
ceefeea428
|
@ -306,8 +306,12 @@ int grib_nearest_smaller_ieee_float(double a, double* ret)
|
||||||
|
|
||||||
init_table_if_needed();
|
init_table_if_needed();
|
||||||
|
|
||||||
if (a > ieee_table.vmax)
|
if (a > ieee_table.vmax) {
|
||||||
|
grib_context* c = grib_context_get_default();
|
||||||
|
grib_context_log(c, GRIB_LOG_ERROR,
|
||||||
|
"Number is too large: x=%e > xmax=%e (IEEE float)", a, ieee_table.vmax);
|
||||||
return GRIB_INTERNAL_ERROR;
|
return GRIB_INTERNAL_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
l = grib_ieee_nearest_smaller_to_long(a);
|
l = grib_ieee_nearest_smaller_to_long(a);
|
||||||
*ret = grib_long_to_ieee(l);
|
*ret = grib_long_to_ieee(l);
|
||||||
|
|
Loading…
Reference in New Issue