honeycombio / husky

a library for translating other data types to Honeycomb-format data structures
Apache License 2.0
2 stars 10 forks source link

fix: Handle invalid content type errors first #243

Closed MikeGoldsmith closed 8 months ago

MikeGoldsmith commented 8 months ago

Which problem is this PR solving?

Updates the error handling logic to check if the error is from an invalid content type first. This is necessary to ensure we can successfully create a valid OTLP response. This needs to be first because it determines how we present any errors back (eg invalid API ket).

This PR also updates WriteOtlpHttpFailureResponse to check if the error is an invalid content type, and write a text/pain response if true. This removes the need for consumers of this function to have to do it themselves.

Short description of the changes