Follow

Struggling to come to a good solution for this API response in go. This is a go app talking to an HTTP/JSON API. If you send the API fucked up data, it will send some 400 class status code and a payload to tell you what went wrong. There are three different payloads, depending on what you screwed up.

I really don't want to send an interface{} back to my users but I'm not coming up with a better way to say "you gave me bad data (or I suck) and here's what the API said about"

@sungo 🤗

Nothing like an upstream API burning you and your users.
@sungo I know that feeling, dealing with external data in go can be a pain sometimes (and APIs can be really shitty too).

@nihl If folks actually understood the value of structured data, it wouldn't be so bad. "You can get any of these 15 structures back for a single API call" is obnoxious in most languages unless you like digging through hashes/dicts/whatever

Sign in to participate in the conversation
hackers.town

A bunch of technomancers in the fediverse. Keep it fairly clean please. This arcology is for all who wash up upon it's digital shore.