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

feat: added a typecheck to prevent further errors #773

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 10 additions & 6 deletions lib/job.js
Expand Up @@ -19,13 +19,17 @@

static fromId(queue, jobId, cb) {
const promise = queue
._commandable()
.then((client) =>
helpers.callAsync((done) =>
client.hget(queue.toKey('jobs'), jobId, done)
._commandable()

Check failure on line 22 in lib/job.js

View workflow job for this annotation

GitHub Actions / test (16.x)

Delete `··`

Check failure on line 22 in lib/job.js

View workflow job for this annotation

GitHub Actions / test (18.x)

Delete `··`

Check failure on line 22 in lib/job.js

View workflow job for this annotation

GitHub Actions / test (20.x)

Delete `··`

Check failure on line 22 in lib/job.js

View workflow job for this annotation

GitHub Actions / test (21.x)

Delete `··`
.then((client) =>

Check failure on line 23 in lib/job.js

View workflow job for this annotation

GitHub Actions / test (16.x)

Delete `··`

Check failure on line 23 in lib/job.js

View workflow job for this annotation

GitHub Actions / test (18.x)

Delete `··`

Check failure on line 23 in lib/job.js

View workflow job for this annotation

GitHub Actions / test (20.x)

Delete `··`

Check failure on line 23 in lib/job.js

View workflow job for this annotation

GitHub Actions / test (21.x)

Delete `··`
helpers.callAsync((done) => {

Check failure on line 24 in lib/job.js

View workflow job for this annotation

GitHub Actions / test (16.x)

Replace `············` with `········`

Check failure on line 24 in lib/job.js

View workflow job for this annotation

GitHub Actions / test (18.x)

Replace `············` with `········`

Check failure on line 24 in lib/job.js

View workflow job for this annotation

GitHub Actions / test (20.x)

Replace `············` with `········`

Check failure on line 24 in lib/job.js

View workflow job for this annotation

GitHub Actions / test (21.x)

Replace `············` with `········`
if (typeof jobId === 'string' || typeof jobId === 'number') {

Check failure on line 25 in lib/job.js

View workflow job for this annotation

GitHub Actions / test (16.x)

Replace `··············` with `··········`

Check failure on line 25 in lib/job.js

View workflow job for this annotation

GitHub Actions / test (18.x)

Replace `··············` with `··········`

Check failure on line 25 in lib/job.js

View workflow job for this annotation

GitHub Actions / test (20.x)

Replace `··············` with `··········`

Check failure on line 25 in lib/job.js

View workflow job for this annotation

GitHub Actions / test (21.x)

Replace `··············` with `··········`
return client.hget(queue.toKey('jobs'), jobId, done);

Check failure on line 26 in lib/job.js

View workflow job for this annotation

GitHub Actions / test (16.x)

Delete `····`

Check failure on line 26 in lib/job.js

View workflow job for this annotation

GitHub Actions / test (18.x)

Delete `····`

Check failure on line 26 in lib/job.js

View workflow job for this annotation

GitHub Actions / test (20.x)

Delete `····`

Check failure on line 26 in lib/job.js

View workflow job for this annotation

GitHub Actions / test (21.x)

Delete `····`
} else {

Check failure on line 27 in lib/job.js

View workflow job for this annotation

GitHub Actions / test (16.x)

Replace `··············` with `··········`

Check failure on line 27 in lib/job.js

View workflow job for this annotation

GitHub Actions / test (18.x)

Replace `··············` with `··········`

Check failure on line 27 in lib/job.js

View workflow job for this annotation

GitHub Actions / test (20.x)

Replace `··············` with `··········`

Check failure on line 27 in lib/job.js

View workflow job for this annotation

GitHub Actions / test (21.x)

Replace `··············` with `··········`
return done(new Error('jobId must be a string'));

Check failure on line 28 in lib/job.js

View workflow job for this annotation

GitHub Actions / test (16.x)

Delete `····`

Check failure on line 28 in lib/job.js

View workflow job for this annotation

GitHub Actions / test (18.x)

Delete `····`

Check failure on line 28 in lib/job.js

View workflow job for this annotation

GitHub Actions / test (20.x)

Delete `····`

Check failure on line 28 in lib/job.js

View workflow job for this annotation

GitHub Actions / test (21.x)

Delete `····`
}

Check failure on line 29 in lib/job.js

View workflow job for this annotation

GitHub Actions / test (16.x)

Delete `····`

Check failure on line 29 in lib/job.js

View workflow job for this annotation

GitHub Actions / test (18.x)

Delete `····`

Check failure on line 29 in lib/job.js

View workflow job for this annotation

GitHub Actions / test (20.x)

Delete `····`

Check failure on line 29 in lib/job.js

View workflow job for this annotation

GitHub Actions / test (21.x)

Delete `····`
})

Check failure on line 30 in lib/job.js

View workflow job for this annotation

GitHub Actions / test (16.x)

Delete `····`

Check failure on line 30 in lib/job.js

View workflow job for this annotation

GitHub Actions / test (18.x)

Delete `····`

Check failure on line 30 in lib/job.js

View workflow job for this annotation

GitHub Actions / test (20.x)

Delete `····`

Check failure on line 30 in lib/job.js

View workflow job for this annotation

GitHub Actions / test (21.x)

Delete `····`
)

Check failure on line 31 in lib/job.js

View workflow job for this annotation

GitHub Actions / test (16.x)

Delete `··`

Check failure on line 31 in lib/job.js

View workflow job for this annotation

GitHub Actions / test (18.x)

Delete `··`

Check failure on line 31 in lib/job.js

View workflow job for this annotation

GitHub Actions / test (20.x)

Delete `··`

Check failure on line 31 in lib/job.js

View workflow job for this annotation

GitHub Actions / test (21.x)

Delete `··`
)
.then((data) => (data ? Job.fromData(queue, jobId, data) : null));
.then((data) => (data ? Job.fromData(queue, jobId, data) : null));

if (cb) helpers.asCallback(promise, cb);
return promise;
Expand Down