Skip to content

Error could offer information about what units are supported #31

@caparker

Description

@caparker

Right now are a sending something like this

stderr | src/adapters/air4thai/air4thai.spec.ts > Simple client example > individual station
** ERROR (UnsupportedParameterError): Parameter currently unsupported 'o3' was provided.

And it would be even better if we could also provide the dev with a list of parameters that are supported in the error.

And the reason we are seeing this error for o3, which is supported, is because we have two forms of it that we support and the parameter may need to include form identifier to differentiate. An alternative to that would be to do the lookup in a slightly different way. Right now the dev provides something like

  parameters = {
    PM25: { parameter: 'pm25', unit: 'ug/m3' },
    PM10: { parameter: 'pm10', unit: 'ug/m3' },
    O3: { parameter: 'o3', unit: 'ppb' },
    CO: { parameter: 'co', unit: 'ppm' },
    NO2: { parameter: 'no2', unit: 'ppb' },
    SO2: { parameter: 'so2', unit: 'ppb' },
 }

And we would need to change the o3 part to the following

  O3: { parameter: 'o3_parts', unit: 'ppb' },

Another idea would be to change the metrics object a little to be

  o3_parts: {
    parameter: 'o3',
    numeric: true,
    units: 'ppm',
    converters: {
      'ppm': noConversion,
      'ppb': ppbToPpm
    }
  },

And use the combination of the parameter and a check on the keys in the converters to get the right metric.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions