sambrmg / mysql-error-codes

A list of error codes in Mysql
0 stars 0 forks source link

the mysql package already offers the same #2

Closed mathieulb closed 2 years ago

mathieulb commented 2 years ago

compare your package with what can already be done using :

const MysqlErrorCodes = require('mysql/lib/protocol/constants/errors')
Casper64 commented 2 years ago

mysql2 doesn't include the typings for typescript for the error codes in their package. That's where I used it for

mathieulb commented 2 years ago

Yeah, I found that a month ago, when replacing mysql by mysql2; the list of errors is somewhere in mysql2, but it's not possible to reach it using import, if I understood correctly. I started using mysql-error-codes just so as to not depend on both mysql and mysql2.

mathieulb commented 2 years ago

... and I don't know why I didn't realise about TS support before. I had the impression that I had compile-time support (and thus editor completions) when using mysql's errors, but that wasn't true, I only was using runtime lookup.

BTW lookup of string by errno is missing in the TS typing. I'm going to open a different ticket for that.