Skip to content

Bug fixes#57

Merged
Kelvinrr merged 11 commits intoDOI-USGS:mainfrom
chkim-usgs:bugfixes
Mar 12, 2025
Merged

Bug fixes#57
Kelvinrr merged 11 commits intoDOI-USGS:mainfrom
chkim-usgs:bugfixes

Conversation

@chkim-usgs
Copy link
Collaborator

@chkim-usgs chkim-usgs commented Mar 3, 2025

Changes made:

  • Renamed kernel_list to kernelList in api.h
  • Added getRestUrl() functionality to use envvar SPICEQL_REST_URL if set
  • Handle exceptions for when useWeb is true
  • Removed duplicate kernel type searches in getTargetStates() and getTargetOrientations()
  • Fixed doubleSclkToEt() to include "base" as a kernelset to search through
  • Updated utcToEt() to use search_for_kernelset() instead of old conf.getLatest() method
  • Removed duplicate findMissionKeywords() function
  • Updated getConfigDirectory() to expect SPICEQL_DEV_DB instead of SSPICE_DEBUG
  • Removed 'defaults' channel in environment.yml
  • Replace SSPICE_DEBUG with SPICEQL_DEV_DB and updated docs to affirm that SPICEQL_DEV_DB must be set to "True" to be used (not like previously where it could be set to anything)

Licensing

This project is mostly composed of free and unencumbered software released into the public domain, and we are unlikely to accept contributions that are not also released into the public domain. Somewhere near the top of each file should have these words:

This work is free and unencumbered software released into the public domain. In jurisdictions that recognize copyright laws, the author or authors of this software dedicate any and all copyright interest in the software to the public domain.

  • I dedicate any and all copyright interest in this software to the public domain. I make this dedication for the benefit of the public at large and to the detriment of my heirs and successors. I intend this dedication to be an overt act of relinquishment in perpetuity of all present and future rights to this software under copyright law.

}
} catch (exception &e) {
checkNaifErrors();
SPDLOG_DEBUG("Could not get a successful response from the web API.");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So in the case of an exception, I think we should throw another excpetion, one of the std exceptions, this way the rest of the function doesn't run. I imagine that would be the preffered behavior.

Also I hate to say this since you already did it, but would it not be better to put the throw catch in spiceAPIQuery so you dont have to change all the functiuons when this logic changes?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that makes sense. The only reason I added the throw catch to each function is because a REST API call can still return a valid JSON object like

{"statusCode":500,"body":{"error":"std::exception: Error Occured:SPICE(NOFRAMECONNECT) ..."}}

and it fails in the specific conversion for each function like json2DFloatArrayTo2DVector() in getTargetStates.
So it seems a better catch would be to check the status code in spiceAPIQuery() and if it's a 500, then to throw an exception.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then check the error code, and make sure it is coverted to a C++ exception by checking it then throwing if statusCode =/= 200.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added another check to see if JSON is valid and two more within each restincurl call.

@Kelvinrr Kelvinrr merged commit 7c9a6e1 into DOI-USGS:main Mar 12, 2025
7 checks passed
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

Successfully merging this pull request may close these issues.

2 participants