Skip to content

fix OptimistickLockError message - #10068

Merged
sushantdhiman merged 2 commits into
sequelize:masterfrom
PavloPoliakov:patch-1
Oct 27, 2018
Merged

fix OptimistickLockError message#10068
sushantdhiman merged 2 commits into
sequelize:masterfrom
PavloPoliakov:patch-1

Conversation

@PavloPoliakov

Copy link
Copy Markdown
Contributor

BaseError expects to receive message, but the options object is being passed.

It leads to this:

SequelizeOptimisticLockError: [object Object]

With the fix the error looks like:

SequelizeOptimisticLockError: Attempting to update a stale model instance: Customers

Pull Request check-list

Please make sure to review and check all of these items:

  • Does npm run test or npm run test-DIALECT pass with this change (including linting)?
  • Does the description below contain a link to an existing issue (Closes #[issue]) or a description of the issue you are solving?
  • Have you added new tests to prevent regressions?
  • Is a documentation update included (if this change modifies existing APIs, or introduces new ones)?
  • Did you follow the commit message conventions explained in CONTRIBUTING.md?

Description of change

@sushantdhiman

Copy link
Copy Markdown
Contributor

This PR needs some tests, you can add new describe section for Optimistic locking here and get reference for sample tests from here, finally assert correct message is returned along with correct error type

@PavloPoliakov

Copy link
Copy Markdown
Contributor Author

That's not what you expect when you use newly released inline edit button on github 😅
But I'll have a look.

@codecov

codecov Bot commented Oct 25, 2018

Copy link
Copy Markdown

Codecov Report

Merging #10068 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master   #10068   +/-   ##
=======================================
  Coverage    96.3%    96.3%           
=======================================
  Files          63       63           
  Lines        9413     9413           
=======================================
  Hits         9065     9065           
  Misses        348      348
Impacted Files Coverage Δ
lib/errors/index.js 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 122bd17...85b2b62. Read the comment docs.

`BaseError` expects to receive `message`, but the `options` object is being passed.

It leads to this:
```
SequelizeOptimisticLockError: [object Object]
```

With the fix the error looks like:
```
SequelizeOptimisticLockError: Attempting to update a stale model instance: Customers
```
@PavloPoliakov

Copy link
Copy Markdown
Contributor Author

@sushantdhiman with all respect, I don't think that integration test is necessary here. The change is very minor and it just does the thing which was originally meant by author.

So I've put additional unit test, just to be rock solid, that message it there and has correct format.

Regards,

@PavloPoliakov PavloPoliakov changed the title Update index.js fix OptimistickLockError message Oct 25, 2018
@sushantdhiman

Copy link
Copy Markdown
Contributor

@PavelPolyakov integration test is important here, I'll add that test myself soon

@sushantdhiman sushantdhiman self-assigned this Oct 26, 2018
@sushantdhiman sushantdhiman removed their assignment Oct 27, 2018
@sushantdhiman
sushantdhiman merged commit fc644f4 into sequelize:master Oct 27, 2018
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

Successfully merging this pull request may close these issues.

2 participants