diff --git a/gdal.cpp b/gdal.cpp index 9e747fe6..b0b08705 100644 --- a/gdal.cpp +++ b/gdal.cpp @@ -955,7 +955,7 @@ Layer VectorDataSet::layer(int index) Layer VectorDataSet::layer(const std::string& name) { assert(_ptr); - return Layer(check_pointer(_ptr->GetLayerByName(name.c_str()), "Invalid layer name")); + return Layer(check_pointer_msg_cb(_ptr->GetLayerByName(name.c_str()), [&]() { return fmt::format("Invalid layer name: {}", name); })); } bool VectorDataSet::layer_exists(const std::string& name) const noexcept