ECC-975: Add new error code: 'Functionality not enabled'

This commit is contained in:
Shahram Najm 2019-08-15 15:58:52 +01:00
parent 480e3ef8ff
commit 09650b9c38
15 changed files with 58 additions and 43 deletions

View File

@ -1,3 +1,4 @@
integer, parameter,public :: CODES_FUNCTIONALITY_NOT_ENABLED = -67
integer, parameter,public :: CODES_WRONG_BITMAP_SIZE = -66
integer, parameter,public :: CODES_OUT_OF_RANGE = -65
integer, parameter,public :: CODES_UNSUPPORTED_EDITION = -64

View File

@ -1,3 +1,4 @@
integer, parameter,public :: GRIB_FUNCTIONALITY_NOT_ENABLED = -67
integer, parameter,public :: GRIB_WRONG_BITMAP_SIZE = -66
integer, parameter,public :: GRIB_OUT_OF_RANGE = -65
integer, parameter,public :: GRIB_UNSUPPORTED_EDITION = -64

View File

@ -139,5 +139,7 @@ Error codes returned by the grib_api functions.
#define GRIB_OUT_OF_RANGE -65
/** Size of bitmap is incorrect */
#define GRIB_WRONG_BITMAP_SIZE -66
/** Functionality not enabled */
#define GRIB_FUNCTIONALITY_NOT_ENABLED -67
/*! @}*/
#endif

View File

@ -25,6 +25,8 @@ class GribInternalError(Exception):
return self.msg
class FunctionalityNotEnabledError(GribInternalError):
"""Functionality not enabled."""
class WrongBitmapSizeError(GribInternalError):
"""Size of bitmap is incorrect."""
class OutOfRangeError(GribInternalError):
@ -159,6 +161,7 @@ class EndOfFileError(GribInternalError):
"""End of resource reached."""
ERROR_MAP = {
-67 : FunctionalityNotEnabledError,
-66 : WrongBitmapSizeError,
-65 : OutOfRangeError,
-64 : UnsupportedEditionError,

View File

@ -9873,6 +9873,7 @@ SWIG_init(void) {
SWIG_Python_SetConstant(d, "GRIB_UNSUPPORTED_EDITION",SWIG_From_int((int)(-64)));
SWIG_Python_SetConstant(d, "GRIB_OUT_OF_RANGE",SWIG_From_int((int)(-65)));
SWIG_Python_SetConstant(d, "GRIB_WRONG_BITMAP_SIZE",SWIG_From_int((int)(-66)));
SWIG_Python_SetConstant(d, "GRIB_FUNCTIONALITY_NOT_ENABLED",SWIG_From_int((int)(-67)));
import_array();

View File

@ -141,6 +141,7 @@ GRIB_ATTRIBUTE_NOT_FOUND = _gribapi_swig.GRIB_ATTRIBUTE_NOT_FOUND
GRIB_UNSUPPORTED_EDITION = _gribapi_swig.GRIB_UNSUPPORTED_EDITION
GRIB_OUT_OF_RANGE = _gribapi_swig.GRIB_OUT_OF_RANGE
GRIB_WRONG_BITMAP_SIZE = _gribapi_swig.GRIB_WRONG_BITMAP_SIZE
GRIB_FUNCTIONALITY_NOT_ENABLED = _gribapi_swig.GRIB_FUNCTIONALITY_NOT_ENABLED
class intp(_object):
__swig_setmethods__ = {}
__setattr__ = lambda self, name, value: _swig_setattr(self, intp, name, value)

View File

@ -1402,5 +1402,7 @@ Error codes returned by the eccodes functions.
#define CODES_OUT_OF_RANGE GRIB_OUT_OF_RANGE
/** Size of bitmap is incorrect */
#define CODES_WRONG_BITMAP_SIZE GRIB_WRONG_BITMAP_SIZE
/** Functionality not enabled */
#define CODES_FUNCTIONALITY_NOT_ENABLED GRIB_FUNCTIONALITY_NOT_ENABLED
/*! @}*/
#endif

View File

@ -527,7 +527,7 @@ static int unpack_double(grib_accessor* a, double* val, size_t *len)
grib_context_log(a->context, GRIB_LOG_ERROR,
"grib_accessor_data_ccsds_packing: CCSDS support not enabled. "
"Please rebuild with -DENABLE_AEC=ON");
return GRIB_NOT_IMPLEMENTED;
return GRIB_FUNCTIONALITY_NOT_ENABLED;
}
static int pack_double(grib_accessor* a, const double* val, size_t *len)
@ -535,7 +535,7 @@ static int pack_double(grib_accessor* a, const double* val, size_t *len)
grib_context_log(a->context, GRIB_LOG_ERROR,
"grib_accessor_data_ccsds_packing: CCSDS support not enabled. "
"Please rebuild with -DENABLE_AEC=ON");
return GRIB_NOT_IMPLEMENTED;
return GRIB_FUNCTIONALITY_NOT_ENABLED;
}
#endif

View File

@ -556,13 +556,13 @@ cleanup:
static int unpack_double(grib_accessor* a, double* val, size_t *len)
{
grib_context_log(a->context, GRIB_LOG_ERROR, "JPEG support not enabled.");
return GRIB_NOT_IMPLEMENTED;
return GRIB_FUNCTIONALITY_NOT_ENABLED;
}
static int pack_double(grib_accessor* a, const double* val, size_t *len)
{
grib_context_log(a->context, GRIB_LOG_ERROR, "JPEG support not enabled.");
return GRIB_NOT_IMPLEMENTED;
return GRIB_FUNCTIONALITY_NOT_ENABLED;
}
#endif

View File

@ -665,7 +665,7 @@ static int unpack_double(grib_accessor* a, double* val, size_t *len)
grib_context_log(a->context, GRIB_LOG_ERROR,
"grib_accessor_data_png_packing: PNG support not enabled. "
"Please rebuild with -DENABLE_PNG=ON");
return GRIB_NOT_IMPLEMENTED;
return GRIB_FUNCTIONALITY_NOT_ENABLED;
}
static int pack_double(grib_accessor* a, const double* val, size_t *len)
@ -673,7 +673,7 @@ static int pack_double(grib_accessor* a, const double* val, size_t *len)
grib_context_log(a->context, GRIB_LOG_ERROR,
"grib_accessor_data_png_packing: PNG support not enabled. "
"Please rebuild with -DENABLE_PNG=ON");
return GRIB_NOT_IMPLEMENTED;
return GRIB_FUNCTIONALITY_NOT_ENABLED;
}
#endif

View File

@ -1706,5 +1706,7 @@ Error codes returned by the grib_api functions.
#define GRIB_OUT_OF_RANGE -65
/** Size of bitmap is incorrect */
#define GRIB_WRONG_BITMAP_SIZE -66
/** Functionality not enabled */
#define GRIB_FUNCTIONALITY_NOT_ENABLED -67
/*! @}*/
#endif

View File

@ -70,6 +70,7 @@ static const char *errors[] = {
"Edition not supported.", /* -64 GRIB_UNSUPPORTED_EDITION */
"Value out of coding range", /* -65 GRIB_OUT_OF_RANGE */
"Size of bitmap is incorrect", /* -66 GRIB_WRONG_BITMAP_SIZE */
"Functionality not enabled", /* -67 GRIB_FUNCTIONALITY_NOT_ENABLED */
"Value mismatch", /* 1 GRIB_VALUE_MISMATCH */
"double values are different", /* 2 GRIB_DOUBLE_VALUE_MISMATCH */
"long values are different", /* 3 GRIB_LONG_VALUE_MISMATCH */

View File

@ -72,3 +72,4 @@ GRIB_ATTRIBUTE_NOT_FOUND Attribute not found.
GRIB_UNSUPPORTED_EDITION Edition not supported.
GRIB_OUT_OF_RANGE Value out of coding range
GRIB_WRONG_BITMAP_SIZE Size of bitmap is incorrect
GRIB_FUNCTIONALITY_NOT_ENABLED Functionality not enabled

View File

@ -217,14 +217,14 @@ int grib_jasper_decode(grib_context *c, unsigned char *buf, size_t *buflen, doub
{
grib_context_log(c, GRIB_LOG_ERROR,
"grib_accessor_data_jpeg2000_packing: Jasper JPEG support not enabled.");
return GRIB_NOT_IMPLEMENTED;
return GRIB_FUNCTIONALITY_NOT_ENABLED;
}
int grib_jasper_encode(grib_context *c, j2k_encode_helper *helper)
{
grib_context_log(c, GRIB_LOG_ERROR,
"grib_accessor_data_jpeg2000_packing: Jasper JPEG support not enabled.");
return GRIB_NOT_IMPLEMENTED;
return GRIB_FUNCTIONALITY_NOT_ENABLED;
}
#endif

View File

@ -535,13 +535,13 @@ cleanup:
int grib_openjpeg_decode(grib_context *c, unsigned char *buf, size_t *buflen, double *val, size_t *n_vals)
{
grib_context_log(c, GRIB_LOG_ERROR, "grib_openjpeg_encoding.c: OpenJPEG JPEG support not enabled.");
return GRIB_NOT_IMPLEMENTED;
return GRIB_FUNCTIONALITY_NOT_ENABLED;
}
int grib_openjpeg_encode(grib_context *c, j2k_encode_helper *helper)
{
grib_context_log(c, GRIB_LOG_ERROR, "grib_openjpeg_encoding.c: OpenJPEG JPEG support not enabled.");
return GRIB_NOT_IMPLEMENTED;
return GRIB_FUNCTIONALITY_NOT_ENABLED;
}
#endif