Skip to content

Commit

Permalink
more tolocalchecked
Browse files Browse the repository at this point in the history
  • Loading branch information
geeksilva97 committed Jan 13, 2025
1 parent def0f06 commit dda982b
Showing 1 changed file with 19 additions and 7 deletions.
26 changes: 19 additions & 7 deletions src/node_sqlite.cc
Original file line number Diff line number Diff line change
Expand Up @@ -162,10 +162,10 @@ class BackupJob : public ThreadPoolWork {
: ThreadPoolWork(env, "node_sqlite3.BackupJob"),
env_(env),
source_(source),
pages_(pages),
source_db_(source_db),
destination_name_(destination_name),
dest_db_(dest_db),
pages_(pages) {
dest_db_(dest_db) {
resolver_.Reset(env->isolate(), resolver);
progressFunc_.Reset(env->isolate(), progressFunc);
}
Expand All @@ -182,7 +182,11 @@ class BackupJob : public ThreadPoolWork {
Local<Object> e = Local<Object>();

if (backup_status_ != SQLITE_OK) {
e = CreateSQLiteError(isolate, pDest_).ToLocalChecked();
if (!CreateSQLiteError(isolate, pDest_).ToLocal(&e)) {
Finalize();

return;
}

Finalize();

Expand All @@ -195,9 +199,13 @@ class BackupJob : public ThreadPoolWork {
pDest_, dest_db_.c_str(), source_->Connection(), source_db_.c_str());

if (pBackup_ == nullptr) {
e = CreateSQLiteError(isolate, pDest_).ToLocalChecked();
if (!CreateSQLiteError(isolate, pDest_).ToLocal(&e)) {
Finalize();

sqlite3_close(pDest_);
return;
}

Finalize();

resolver->Reject(env()->context(), e).ToChecked();

Expand All @@ -218,8 +226,12 @@ class BackupJob : public ThreadPoolWork {

if (!(backup_status_ == SQLITE_OK || backup_status_ == SQLITE_DONE ||
backup_status_ == SQLITE_BUSY || backup_status_ == SQLITE_LOCKED)) {
Local<Object> e =
CreateSQLiteError(env()->isolate(), backup_status_).ToLocalChecked();
Local<Object> e;
if (!CreateSQLiteError(env()->isolate(), backup_status_).ToLocal(&e)) {
Finalize();

return;
}

Finalize();

Expand Down

0 comments on commit dda982b

Please sign in to comment.