有没有一套“通用”的方法?错误/异常代码?
当谈到编程语言时,我有点精通多种语言,而且我使用的大多数语言都有某种类型的错误/异常处理。
在大多数语言中,都有错误 ID 及其相关消息的默认实现,但我从未找到一个生产代码列表来作为我自己的错误代码的基础。
这样的事存在吗?
如果没有,它会有用吗?或者只是大多数程序员忽略的噪音?
I'm a bit of a polyglot when it comes to programming languages, and most of the languages I use have Error/Exception handling of some sort.
In most languages there's a default implementation of error ID's with their associated messages, but I've never found a list of production codes to base my own error codes off of.
Does such a thing exist?
If not would it be useful, or just noise that most programmers ignore?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我能想到的最接近的是 POSIX 错误常量 (尽管它们的数值未标准化。)
The closest thing I can think of is POSIX error constants (though their numeric values are not standardized.)
简短的回答 - 不,它不存在。每个操作系统、平台和软件几乎都有自己的错误 ID。这些不同步或基于任何标准集。
我想说,除了常见的错误之外,这确实只是噪音,即使是常见的错误,也需要将它们标准化并确保它们被普遍使用。
Short answer - no, it doesn't exist. Every OS, platform and piece of software pretty much has its own error IDs. These are not synchronized or based on any standard set.
I would say that apart from the common errors, this would indeed just be noise, and even with the common one, one one need to standardize them and ensure they are used universally.