The @ydbjs/error
package provides utilities for handling YDB-specific errors in JavaScript/TypeScript applications. It simplifies error classification and provides detailed error messages for better debugging and troubleshooting.
- Error classification for YDB-specific error codes
- Detailed error messages with severity levels
- TypeScript support with type definitions
Install the package using npm:
npm install @ydbjs/[email protected]
import { YDBError } from '@ydbjs/error';
import { StatusIds_StatusCode } from '@ydbjs/api/operation';
try {
throw new YDBError(StatusIds_StatusCode.ABORTED, [
{ severity: 0, issueCode: 14, message: 'Some error message' },
]);
} catch (error) {
if (error instanceof YDBError) {
console.error('YDB Error:', error.message);
console.error('Error Code:', error.code);
}
}
npm run build
npm test
For watch mode during development:
npm run test:watch
This project is licensed under the Apache 2.0 License.