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

fix OptimistickLockError message #10068

Merged
merged 2 commits into from Oct 27, 2018
Merged

Conversation

@PavelPolyakov
Copy link
Contributor

@PavelPolyakov PavelPolyakov commented Oct 23, 2018

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
Contributor

@sushantdhiman sushantdhiman commented Oct 25, 2018

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

@PavelPolyakov
Copy link
Contributor Author

@PavelPolyakov PavelPolyakov commented Oct 25, 2018

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

@PavelPolyakov PavelPolyakov force-pushed the PavelPolyakov:patch-1 branch from 6748016 to 3cbf888 Oct 25, 2018
@codecov
Copy link

@codecov codecov bot commented Oct 25, 2018

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
```
@PavelPolyakov PavelPolyakov force-pushed the PavelPolyakov:patch-1 branch from 3cbf888 to c300e93 Oct 25, 2018
@PavelPolyakov
Copy link
Contributor Author

@PavelPolyakov PavelPolyakov commented Oct 25, 2018

@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,

@PavelPolyakov PavelPolyakov changed the title Update index.js fix OptimistickLockError message Oct 25, 2018
@sushantdhiman
Copy link
Contributor

@sushantdhiman sushantdhiman commented Oct 26, 2018

@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
4 checks passed
4 checks passed
codecov/patch 100% of diff hit (target 96.3%)
Details
codecov/project 96.3% (+0%) compared to 122bd17
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants