> The log system will be overhauled - one thing in particular we'll take from Typescript are diagnostic error codes. Each error, warning, and sometimes notice will be given a unique code that will be documented - with explanations to help you understand how to unblock yourself.
Why do programmers love error codes? As an end user, they are useless indirection to me and the only way this would even be tolerable is if the explanation was printed directly next to the error code, so why bother? Is it code quality, since you don't have to write a long error message when you emit a similar error? But doesn't that have the drawback of encouraging error code reuse when it might not be appropriate?
[append]
Thanks for the replies! I guess I could understand error codes for search ability that also provide information about the problem specifics.
Counterexample:
$ yarn add foo
Error YARN1001: Incompatible peerDependencies.
$ yarn explain YARN1001
# Some longer text about how two of my modules have
# incompatible peerDependencies
Why do programmers love error codes? As an end user, they are useless indirection to me and the only way this would even be tolerable is if the explanation was printed directly next to the error code, so why bother? Is it code quality, since you don't have to write a long error message when you emit a similar error? But doesn't that have the drawback of encouraging error code reuse when it might not be appropriate?
[append]
Thanks for the replies! I guess I could understand error codes for search ability that also provide information about the problem specifics.
Counterexample:
Better example: