almost everyone who uses javascript daily knows that try-catch can be painful to deal with, especially when you have more than one error to handle. most proposed solutions are tryng to copy...
javascript 中的 try-catch 处理多个错误较繁琐。借鉴 go 语言的错误处理模式,可以通过返回数组来改进。定义接口 status,返回值包含状态信息,增强类型安全性。实现 grip 函数,装饰函数和 promise,返回结果可作为对象或元组处理,提供更优雅的错误处理方式,代码简洁易用。