Skip to content

Improve handling of NSRDB API call errors#1018

Merged
cpaulgilman merged 1 commit into
patchfrom
nsrdb_error
Apr 29, 2022
Merged

Improve handling of NSRDB API call errors#1018
cpaulgilman merged 1 commit into
patchfrom
nsrdb_error

Conversation

@cpaulgilman

@cpaulgilman cpaulgilman commented Apr 26, 2022

Copy link
Copy Markdown
Collaborator

Some types of API errors return JSON with an error message, and others return HTML with an error code. This fix better handles situation where HTML is returned.

One test is to try to download a file for a location that is not in the NSRDB, for example, this lat/lon pair: 65,-122.7.

Fixes #1017

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

If you have added a new compute module in a SSC pull request related to this one, be sure to check the Process Requirements.

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules
  • I have checked my code and corrected any misspellings

Some types of API errors return JSON with an error message, and others return HTML with an error code. This fix better handles situation where HTML is returned.
@cpaulgilman cpaulgilman added this to the 2021.12.02 Patch 2 milestone Apr 26, 2022
@cpaulgilman cpaulgilman requested a review from sjanzou April 26, 2022 22:33
@cpaulgilman cpaulgilman self-assigned this Apr 26, 2022

@sjanzou sjanzou left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looks and works great!

@brtietz

brtietz commented Apr 29, 2022

Copy link
Copy Markdown
Collaborator

Does anything in nsrdb.cpp need to be adjusted to match for the advanced download? There was a recent error in the psm3-tmy specification that this sort of debugging would have helped with. See #1022 and #1023 for details.

@cpaulgilman

Copy link
Copy Markdown
Collaborator Author

Does anything in nsrdb.cpp need to be adjusted to match for the advanced download? There was a recent error in the psm3-tmy specification that this sort of debugging would have helped with. See #1022 and #1023 for details.

That's a good point. I was able to write the code in the UI callback script while the NSRDB was down so I could test to make sure it worked properly. I'm hesitant to replicate that code in nsrdb.cpp now that I can't test it with the NSRDB back up and running. Depending on the state of the NSRDB it either returns a CSV weather file, a JSON file with error messages, or an HTML file with error messages.

@cpaulgilman cpaulgilman merged commit f8edbbd into patch Apr 29, 2022
@cpaulgilman cpaulgilman deleted the nsrdb_error branch April 29, 2022 15:56
@cpaulgilman cpaulgilman added the added to release notes PR and/or issue has been added to release notes for a public release label Jun 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

added to release notes PR and/or issue has been added to release notes for a public release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

NSRDB solar resource download returns script error when HTML error encountered

3 participants