-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #31 from NodeRedis/fix-errors
Fix stack traces
- Loading branch information
Showing
13 changed files
with
103 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,4 @@ logs | |
coverage | ||
node_modules | ||
.idea | ||
.vscode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,3 +11,5 @@ test | |
.travis.yml | ||
.gitignore | ||
*.log | ||
.vscode | ||
.codeclimate.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
'use strict' | ||
|
||
var util = require('util') | ||
var assert = require('assert') | ||
var RedisError = require('./redisError') | ||
var ADD_STACKTRACE = false | ||
|
||
function ParserError (message, buffer, offset) { | ||
assert(buffer) | ||
assert.strictEqual(typeof offset, 'number') | ||
RedisError.call(this, message, ADD_STACKTRACE) | ||
this.offset = offset | ||
this.buffer = buffer | ||
Error.captureStackTrace(this, ParserError) | ||
} | ||
|
||
util.inherits(ParserError, RedisError) | ||
|
||
Object.defineProperty(ParserError.prototype, 'name', { | ||
value: 'ParserError', | ||
configurable: true, | ||
writable: true | ||
}) | ||
|
||
module.exports = ParserError |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
'use strict' | ||
|
||
/* eslint-env mocha */ | ||
|
||
var assert = require('assert') | ||
var ReplyError = require('../lib/replyError') | ||
var ParserError = require('../lib/parserError') | ||
var RedisError = require('../lib/redisError') | ||
|
||
describe('errors', function () { | ||
it('errors should have a stack trace with error message', function () { | ||
var err1 = new RedisError('test') | ||
var err2 = new ReplyError('test') | ||
var err3 = new ParserError('test', new Buffer(''), 0) | ||
assert(err1.stack) | ||
assert(err2.stack) | ||
assert(err3.stack) | ||
assert(/RedisError: test/.test(err1.stack)) | ||
assert(/ReplyError: test/.test(err2.stack)) | ||
assert(/ParserError: test/.test(err3.stack)) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters