Follow

So ghow do you folks map error enums (with possibly attached values) to strings? A big honkin’ if/then/else? Or is there a way that’s less work and maybe uses the tags on the values to indicate where in the format they go?

@uliwitness
What language? In C and Python you can embed X-to-string formatting right in the error string.

And please use a case statement instead of if/then/else.

@yerazunis Swift. And yeah, I ended up using a switch. Doesn't feel much better for something that feels like it could be generated for me.

Sign in to participate in the conversation
Mastodon for Tech Folks

This Mastodon instance is for people interested in technology. Discussions aren't limited to technology, because tech folks shouldn't be limited to technology either!

We adhere to an adapted version of the TootCat Code of Conduct and follow the Toot Café list of blocked instances. Ash is the admin and is supported by Fuzzface as a moderator.

Hosting costs are largely covered by our generous supporters on Patreon – thanks for all the help!