feat(NODE-7100): make MONGODB_ERROR_CODES public#4615
feat(NODE-7100): make MONGODB_ERROR_CODES public#4615Khongchai wants to merge 1 commit intomongodb:mainfrom
Conversation
|
Hi @Khongchai, thanks for the contribution. We have a ticket tracking this and will discuss in our triage next week. |
|
Would be nice if the duplicate key error could be added as well, right now I have a helper function which checks |
|
Hey @Khongchai , would you mind elaborating a bit on exactly what your use case for this feature would be and exactly what you'd like to see from us if we were to make this enum public? Are you looking for a more descriptive name for a particular error or maybe looking to understand what a particular error means? As @marcesengel alludes to, this error enum is not exhaustive (it only contains error codes we use in the driver). MongoDB's error codes are also officially documented. |
|
@baileympearson I see. I did not look through the entire list thoroughly, thought it was exhaustive. Our use case is the same as @marcesengel. We also check against error code 26. Considering that it's just something you created to use internally and it's not exhaustive, I'll just close this PR. Thanks, everyone! |
Description
Made MONGODB_ERROR_CODES public
What is the motivation for this change?
We have a use case where accessing the error code definition is useful for error checking. Checking
e.code === MONGODB_ERROR_CODES.Somethingseems pretty useful. The object is already frozen so we can't just accidentally modify this.This is a small type change so I haven't run any tests / compilation yet. But would be happy to do so if still required! Thanks, mongodb team