Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add check for duplicated obj names #177

Open
CeresBarros opened this issue Oct 29, 2021 · 0 comments
Open

Add check for duplicated obj names #177

CeresBarros opened this issue Oct 29, 2021 · 0 comments

Comments

@CeresBarros
Copy link
Member

CeresBarros commented Oct 29, 2021

Just hit an interesting error that took me a while to debug.

I accidentally duplicated an object in the objects list which caused the end of simInit to crash (righ after completing the final inputObjects
The error was:

Oct29 15:43:15 simInit: frSns_ Running .inputObjects for fireSense_IgnitionPredict
Error in list2env(value, envir = [email protected]) : 
  attempt to use zero-length variable name

By inserting a browser at the end of the last inputObjects I was able to notice the "empty" slot in [email protected]$.userSuppliedObjNames.

Browse[1]> list2env([email protected])
Error in list2env([email protected]) : first argument must be a named list
Browse[1]> [email protected]$.userSuppliedObjNames
 [1] "studyArea"           "studyAreaLarge"      "sppEquiv"            "sppColorVect"        "speciesParams"      
 [6] "ecoregionLayer"      "PSPgis"              "PSPmeasure"          "PSPplot"             "rstLCC"             
[11] ""                    "fireLocations"       "nonForestFuelsTable" "FirePFGs2Fuels"      "weatherDataMDC"     
[16] "weatherData"         "weatherDataPred"     "weatherDataCRS"      "weatherDataMDCCRS"  

I was lucky that I checked that object first, I guess, because that made me realize that I had two "fireLocation" objects being passed and after removing one, the empty slot and error went away.
A good old "edge case", but perhaps a check for duplicated object names would prevent this "mysterious" error, which will be hard to debug for most people (or developpers without a good reprex) .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant