mirror of https://github.com/ecmwf/eccodes.git
ECC-975: Add new error code: 'Functionality not enabled'
This commit is contained in:
parent
480e3ef8ff
commit
09650b9c38
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 */
|
||||
|
@ -89,27 +90,27 @@ static const char *errors[] = {
|
|||
|
||||
const char* grib_get_error_message(int code)
|
||||
{
|
||||
code = -code;
|
||||
if (code < 0 || code >= NUMBER(errors)) {
|
||||
static char mess[64];
|
||||
sprintf(mess,"Unknown error %d",code);
|
||||
return mess;
|
||||
}
|
||||
return errors[code];
|
||||
code = -code;
|
||||
if (code < 0 || code >= NUMBER(errors)) {
|
||||
static char mess[64];
|
||||
sprintf(mess,"Unknown error %d",code);
|
||||
return mess;
|
||||
}
|
||||
return errors[code];
|
||||
}
|
||||
|
||||
void grib_check(const char* call, const char* file, int line, int e, const char* msg)
|
||||
{
|
||||
grib_context* c=grib_context_get_default();
|
||||
if (e) {
|
||||
if (file) {
|
||||
fprintf(stderr,"%s at line %d: %s failed: %s",
|
||||
file,line, call,grib_get_error_message(e));
|
||||
if (msg) fprintf(stderr," (%s)",msg);
|
||||
printf("\n");
|
||||
} else {
|
||||
grib_context_log(c,GRIB_LOG_ERROR,"%s",grib_get_error_message(e));
|
||||
}
|
||||
exit(e);
|
||||
}
|
||||
grib_context* c=grib_context_get_default();
|
||||
if (e) {
|
||||
if (file) {
|
||||
fprintf(stderr,"%s at line %d: %s failed: %s",
|
||||
file,line, call,grib_get_error_message(e));
|
||||
if (msg) fprintf(stderr," (%s)",msg);
|
||||
printf("\n");
|
||||
} else {
|
||||
grib_context_log(c,GRIB_LOG_ERROR,"%s",grib_get_error_message(e));
|
||||
}
|
||||
exit(e);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -48,27 +48,28 @@ GRIB_END End of resource
|
|||
GRIB_NO_VALUES Unable to code a field without values
|
||||
GRIB_WRONG_GRID Grid description is wrong or inconsistent
|
||||
GRIB_END_OF_INDEX End of index reached
|
||||
GRIB_NULL_INDEX Null index
|
||||
GRIB_NULL_INDEX Null index
|
||||
/* Even more errors */
|
||||
GRIB_PREMATURE_END_OF_FILE End of resource reached when reading message
|
||||
GRIB_INTERNAL_ARRAY_TOO_SMALL An internal array is too small
|
||||
GRIB_MESSAGE_TOO_LARGE Message is too large for the current architecture
|
||||
GRIB_CONSTANT_FIELD Constant field
|
||||
GRIB_SWITCH_NO_MATCH Switch unable to find a matching case
|
||||
GRIB_UNDERFLOW Underflow
|
||||
GRIB_UNDERFLOW Underflow
|
||||
GRIB_MESSAGE_MALFORMED Message malformed
|
||||
GRIB_CORRUPTED_INDEX Index is corrupted
|
||||
GRIB_INVALID_BPV Invalid number of bits per value
|
||||
GRIB_DIFFERENT_EDITION Edition of two messages is different
|
||||
GRIB_DIFFERENT_EDITION Edition of two messages is different
|
||||
GRIB_VALUE_DIFFERENT Value is different
|
||||
GRIB_INVALID_KEY_VALUE Invalid key value
|
||||
GRIB_STRING_TOO_SMALL String is smaller than requested
|
||||
GRIB_WRONG_CONVERSION Wrong type conversion
|
||||
GRIB_MISSING_BUFR_ENTRY Missing BUFR table entry for descriptor
|
||||
GRIB_NULL_POINTER Null pointer
|
||||
GRIB_ATTRIBUTE_CLASH Attribute is already present, cannot add
|
||||
GRIB_TOO_MANY_ATTRIBUTES Too many attributes. Increase MAX_ACCESSOR_ATTRIBUTES
|
||||
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_INVALID_KEY_VALUE Invalid key value
|
||||
GRIB_STRING_TOO_SMALL String is smaller than requested
|
||||
GRIB_WRONG_CONVERSION Wrong type conversion
|
||||
GRIB_MISSING_BUFR_ENTRY Missing BUFR table entry for descriptor
|
||||
GRIB_NULL_POINTER Null pointer
|
||||
GRIB_ATTRIBUTE_CLASH Attribute is already present, cannot add
|
||||
GRIB_TOO_MANY_ATTRIBUTES Too many attributes. Increase MAX_ACCESSOR_ATTRIBUTES
|
||||
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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue