add check for max h3 resolution

This commit is contained in:
bharatnc 2022-02-12 22:05:28 -08:00
parent e02bd7d785
commit b50005e702

View File

@ -11,6 +11,7 @@
#include <Common/typeid_cast.h>
#include <base/range.h>
#include <constants.h>
#include <h3api.h>
@ -109,6 +110,14 @@ public:
const double lat = data_lat[row];
const UInt8 res = data_res[row];
if (res > MAX_H3_RES)
throw Exception(
ErrorCodes::ARGUMENT_OUT_OF_BOUND,
"The argument 'resolution' ({}) of function {} is out of bounds because the maximum resolution in H3 library is ",
toString(res),
getName(),
MAX_H3_RES);
LatLng coord;
coord.lng = degsToRads(lon);
coord.lat = degsToRads(lat);