Skip to content

Export error codes in lib #21622

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Yogu opened this issue Jan 8, 2025 · 4 comments
Open

Export error codes in lib #21622

Yogu opened this issue Jan 8, 2025 · 4 comments

Comments

@Yogu
Copy link

Yogu commented Jan 8, 2025

It would be nice if there was a public (non-"lib") file with constants for all of ArangoDB's error codes, to use them in your own error handling

Could just take this definition file and do a regex replacement into typescript. I did that once for our cruddl lib

@ghost
Copy link

ghost commented Jan 13, 2025

ArangoDB generates a JS version of that DAT file already: https://github.com/arangodb/arangodb/blob/devel/js/common/bootstrap/errors.js

This is out of scope for arangojs as the error codes can change in new versions of ArangoDB but there may be a way to get these from another npm module in the near future.

@Yogu
Copy link
Author

Yogu commented Jan 13, 2025

This is out of scope for arangojs as the error codes can change in new versions of ArangoDB

Why does this specifically apply to error codes? How are they any different from other parts of the API?

  • If a new version of arangodb introduces a new error code, of course I need to update arangojs to have this new error code, just like I would need to update arangojs to use a new API, or to support additional options on an existing API
  • If a new version of arangodb removes an error code, arangojs could keep them and mark them as deprecated until the release of a new arangojs version that drops support for older arangodb versions - just like it's probably done for API removals.

If there is too much fuctuation in error code meanings for even arangojs to have a mapping, I wonder how I could possibly write an application or a library that supports multiple ArangoDB versions. I hope the error codes don't just arbitrarily change without announcement.

I'm fine with this not being implemented, just thought I could get rid of the definition file in our open-source library, but I don't quite understand how it would not fit into arangojs.

@ghost
Copy link

ghost commented Feb 14, 2025

I think a case could be made for publishing the error codes separately on npm. I'll raise this for internal discussion.

@ghost ghost transferred this issue from arangodb/arangojs Feb 14, 2025
@dothebart
Copy link
Contributor

added generators:
#21623

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants