src: add .code and SSL specific error properties by sam-github · Pull Request #25093 · nodejs/node (original) (raw)
SSL errors have a long structured message, but lacked the standard .code
property which can be used for stable comparisons. Add a code
property, as well as the 3 string components of an SSL error: reason
,library
, and function
.
This is WIP, TBD is move the property strings to the isolate, and add docs and more tests.
I've seen a reasonable amount of code that is doing string matching on the error string, looking for the reason part, I think exposing the properties makes more sense. Also, I think the intention is for all Errors to expose .code
properties for stable programmatic inspection.
I've gone some way to exposing these properties for node_crypto.cc, too, but I'm not done. Once this PR lands I'll keep working on it.
/to @nodejs/crypto
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes- tests and/or benchmarks are included
- documentation is changed or added
- commit message follows commit guidelines