Qiku ← Back to library

AI / Coding and Debugging

Document the Error Contract

Document the Error Contract — Chinese original prompt

请为 [函数/接口] 写一份错误契约:它在什么条件下抛错、抛什么类型、调用方必须处理哪些、哪些可以直接冒泡。用一张表列出错误类型、触发条件、调用方应做的动作。再检查现有实现是否违反这份契约——该抛的没抛、抛了却没写进文档的,列出偏差清单。
Site original

Chinese original

How to use

契约写完,让一个没读过这段代码的人按表判断调用点写得对不对。

More in this topic