Parser Errors: Context and Ergonomics

Episode #177 • Feb 7, 2022 • Subscriber-Only

Let’s make errors a pleasure to encounter! We will make them easy to read, add more context to make them easy to debug, and even see how error messages can influence existing APIs.

Context and Ergonomics
Introduction
00:05
Contextual errors
00:43
Better contextual errors
04:51
`OneOf` errors
18:16
Conclusion
43:01

Unlock This Episode

Our Free plan includes 1 subscriber-only episode of your choice, plus weekly updates from our newsletter.

Introduction

This is already pretty nice. We are running 5 parsers on the input string, and the error message has made it much easier for us to track down that something is wrong with the boolean in the string.

Now luckily the input string is quite short, and there’s only one boolean we are trying to parse, so it’s simple to figure out exactly what went wrong. However, if the input was hundreds or thousands of characters long and there were multiple places we were parsing booleans then it wouldn’t be super helpful to know that somewhere a boolean failed to parse. We’d also like to know where exactly the parse failure happened.

Let’s see what it takes to do that.

This episode is for subscribers only.

Subscribe to Point-Free

Access this episode, plus all past and future episodes when you become a subscriber.

See plans and pricing

Already a subscriber? Log in

Downloads