Interesting approach and nice article. As some other comments have mentioned, this is similar to the Either pattern. Another you might be interested in is the Try type pattern. It originates (I think) from scala, but it can be implemented pretty easily in any language (such as my implementation of it for javascript on npm, "fp-try").