Skip to content
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

Enhance Database Operation Resilience with Fallback Mechanisms #10

Closed
ramoncibas opened this issue Feb 2, 2024 · 1 comment
Closed
Assignees
Labels
code refactoring Makes an improvement in the code, does not necessarily fix a bug

Comments

@ramoncibas
Copy link
Owner

The current implementation of database operations lacks a robust error-handling strategy, resulting in potential issues and limited resilience to unforeseen errors. The absence of fallback mechanisms and detailed error logging hinders effective debugging and error diagnosis.

// No fallback if the operation breaks down,
public run(sql: string, params: any[]): Promise<RunResult> {
  return new Promise<RunResult>((resolve, reject) => {
    this.db.run(sql, params, function (err) {
      if (err) {
        console.error('Error executing query:', err.message);
        reject(err);
      } else {
        resolve(this);
      }
    });
  });
}
@ramoncibas ramoncibas self-assigned this Feb 2, 2024
@ramoncibas ramoncibas added the code refactoring Makes an improvement in the code, does not necessarily fix a bug label Feb 2, 2024
@ramoncibas ramoncibas pinned this issue Feb 2, 2024
@ramoncibas
Copy link
Owner Author

Adjusted in PR (#11) where a transaction mechanism is introduced for critical database operations, ensuring data consistency. PR includes methods for initiating, committing, and rolling back transactions, increasing the reliability of database interactions. You can use the transaction function to encapsulate operations in a single recoverable transaction block.

@ramoncibas ramoncibas mentioned this issue Feb 9, 2024
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code refactoring Makes an improvement in the code, does not necessarily fix a bug
Projects
None yet
Development

No branches or pull requests

1 participant