NOAA-OWP / wres

Code and scripts for the Water Resources Evaluation Service
Other
2 stars 1 forks source link

As a user, I want the full error message/context when receiving a 4xx error from a web service #120

Open epag opened 2 months ago

epag commented 2 months ago

Author Name: James (James) Original Redmine Issue: 118741, https://vlab.noaa.gov/redmine/issues/118741 Original Date: 2023-07-25


Given an evaluation that makes an incorrect request to a web service When the web service responds with a useful error Then the software should reveal this error and not just the 4xx

epag commented 2 months ago

Original Redmine Comment Author Name: James (James) Original Date: 2023-07-25T15:22:07Z


Example, noting the blunder with the feature name on the left side.

observed:
  sources:
    uri: https://nwis.waterservices.usgs.gov/nwis/iv
    interface: usgs nwis
  variable: '00060'
predicted:
  sources:
    - uri: dist/data/drrc2ForecastsOneMonth/
      pattern: '**/*.xml*'
  variable: SQIN
  label: HEFS
baseline:
  sources:
    uri: https://nwis.waterservices.usgs.gov/nwis/iv
    interface: usgs nwis
  variable: '00060'
  method: 
    name: climatology
    minimum_date: 1950-10-01T00:00:00Z
    maximum_date: 2020-11-01T00:00:00Z
features:
  - {observed: DRRC2HSF, predicted: DRRC2HSF, baseline: '09165000'}
unit: CMS
lead_times:
  minimum: 1
  maximum: 24
  unit: hours
valid_dates:
  minimum: 1980-05-12T12:00:00Z
  maximum: 2020-05-20T12:00:00Z
lead_time_pools:
  period: 0
  frequency: 1
  unit: hours
probability_thresholds:
  values: [0.1, 0.25, 0.5, 0.75, 0.9, 0.95]
  operator: greater equal
metrics:
  - mean error
  - mean square error skill score
  - brier score
  - sample size
  - reliability diagram
decimal_format: '#0.000000'
output_formats:
  - csv
  - pairs
  - png
</code>

Inner error from WRES:

Caused by: wres.io.reading.ReadException: Failed to read data from 'https://nwis.waterservices.usgs.gov/nwis/iv?endDT=1981-01-01T00%3A00%3A00Z&format=json&parameterCd=00060&sites=DRRC2HSF&startDT=1980-01-01T00%3A00%3A01Z' due to HTTP status code 400
    at wres.io.reading.nwis.NwisReader.getByteStreamFromUri(NwisReader.java:475)
    at wres.io.reading.nwis.NwisReader.lambda$getTimeSeriesTuple$2(NwisReader.java:338)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)

Actual error reported by server:

https://nwis.waterservices.usgs.gov/nwis/iv?endDT=1981-01-01T00%3A00%3A00Z&format=json&parameterCd=00060&sites=DRRC2HSF&startDT=1980-01-01T00%3A00%3A01Z

Invalid Site number format: character is not a digit at argument 0, position 0, server=[nadww02]

It would be useful to report that context, so that a user can more quickly identify and fix the problem.