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: better cache adapter error handling #102

Merged
merged 2 commits into from
Dec 23, 2020
Merged

Conversation

wschurman
Copy link
Member

Why

The cache adapter equivalent to #101. Redis/ioredis doesn't throw any specific errors with codes, just a single error type ReplyError with a message (https://github.com/luin/ioredis#error-handling) so we just assume that all redis errors are transient.

How

Add new error class and error code, wrap ioredis calls, add test.

Test Plan

Run test.

@wschurman wschurman requested a review from ide December 23, 2020 06:20
@codecov
Copy link

codecov bot commented Dec 23, 2020

Codecov Report

Merging #102 (76ecb64) into master (5208aee) will increase coverage by 0.04%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #102      +/-   ##
==========================================
+ Coverage   94.91%   94.95%   +0.04%     
==========================================
  Files          65       66       +1     
  Lines        1612     1626      +14     
  Branches      196      196              
==========================================
+ Hits         1530     1544      +14     
  Misses         80       80              
  Partials        2        2              
Flag Coverage Δ
integration 94.95% <100.00%> (+0.04%) ⬆️
unittest 94.95% <100.00%> (+0.04%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...ntity-cache-adapter-redis/src/RedisCacheAdapter.ts 100.00% <100.00%> (ø)
...he-adapter-redis/src/errors/wrapNativeRedisCall.ts 100.00% <100.00%> (ø)
...-adapter-knex/src/PostgresEntityDatabaseAdapter.ts 100.00% <100.00%> (ø)
...-adapter-knex/src/errors/wrapNativePostgresCall.ts 100.00% <100.00%> (ø)
packages/entity/src/errors/EntityError.ts 100.00% <100.00%> (ø)

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 5208aee...76ecb64. Read the comment docs.

@wschurman wschurman merged commit 15546aa into master Dec 23, 2020
@wschurman wschurman deleted the @wschurman/error-stuff-2 branch December 23, 2020 21:47
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