Skip to content

Commit

Permalink
feat(hydrate): throw error on empty cache
Browse files Browse the repository at this point in the history
  • Loading branch information
stephanebachelier committed Jan 4, 2016
1 parent 0fc9d62 commit c9c5f5a
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/hydrate.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@ import response from './response'
export default function (req) {
return function (value) {
return new Promise((resolve, reject) => {
if (!value) {
var error = new Error()
error.reason = 'cache-miss'
error.message = 'Value not found from cache'
reject(error)
}

// override request end callback
req.end((err, res) => {
const callback = req.callback // main callback
Expand Down

0 comments on commit c9c5f5a

Please sign in to comment.