-
Notifications
You must be signed in to change notification settings - Fork 8
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good work. Thank you for following the defined organization.
I have one question, do you think it would be appropriate to add a mechanism for error code lookup? We do it in:
controls/lib/controls/server-side-sorting-response-control.js
Lines 9 to 27 in 9718b85
const validCodeNames = [ | |
'SUCCESS', | |
'OPERATIONS_ERROR', | |
'TIME_LIMIT_EXCEEDED', | |
'STRONGER_AUTH_REQUIRED', | |
'ADMIN_LIMIT_EXCEEDED', | |
'NO_SUCH_ATTRIBUTE', | |
'INAPPROPRIATE_MATCHING', | |
'INSUFFICIENT_ACCESS_RIGHTS', | |
'BUSY', | |
'UNWILLING_TO_PERFORM', | |
'OTHER' | |
] | |
const filteredCodes = Object.entries(RESULT_CODES).filter(([k, v]) => validCodeNames.includes(k)) | |
const VALID_CODES = new Map([ | |
...filteredCodes, | |
...filteredCodes.map(([k, v]) => { return [v, k] }) | |
]) |
controls/lib/controls/server-side-sorting-response-control.js
Lines 44 to 49 in 9718b85
/** | |
* A map of possible response codes. Includes `CODE => VALUE` and | |
* `VALUE => CODE`. For example, `RESPONSE_CODES.get(0)` returns | |
* `LDAP_SUCCESS`, and `RESPONSE_CODES.get('LDAP_SUCCESS')` returns `0`. | |
*/ | |
static RESPONSE_CODES = Object.freeze(VALID_CODES) |
Thanks, I had avoided a lookup like that as the error codes in the control don't match the result codes defined in the protocol. Also no mapping is defined in the similar case: controls/lib/controls/entry-change-notification-control.js Lines 8 to 14 in 9718b85
I'd be happy to create some kind of mapping though. |
That's fair. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
I've done the steps outlined in ldapjs/node-ldapjs#946 (comment) but haven't linked to the issue as it's closed. Let me know if there's anything else I should do!