- React
- ReactiveConf
- 2018
- Modeling errors in Now CLI
Modeling errors in Now CLI
Javi Velasco at ReactiveConf 2018
At ZEIT I'm in charge of the Now CLI, the easiest and simplest way to deploy serverlessly to the cloud. Just execute now against any directory or file in the filesystem, and a deployment is instantly made to our global network. The main program and its subcommands query our different API endpoints (https://zeit.co/api). For example, when creating a deployment we first upload all its files (File Upload API), followed by deployment creation (Deployment API) and then we ensure it can run for the first time (Instances API). Errors can occur at any stage of this pipeline: network errors, transient API failures, failed API validations or requirements, rate limiting due to too many requests, among many others. This talk describes how we modeled our error-handling system for asynchronous operations using Flow, in order to: - Provide a scalable system that allows us to grow our API and subcommands as our business quickly evolves - Ensure that the developer is aware of the entire error space for each operation they perform by leveraging the type system (e.g.: no unknown exceptions) - Provide accurate and easy-to-understand error messages in combination with https://err.sh hyperlinks