Browse Source

v2.0.1: Map unknown errors to scrypt.InternalError correctly

Sven Slootweg 5 years ago
parent
commit
697e18dd2b
3 changed files with 4 additions and 3 deletions
  1. 1 1
      lib/scrypt-for-humans.coffee
  2. 2 1
      lib/scrypt-for-humans.js
  3. 1 1
      package.json

+ 1 - 1
lib/scrypt-for-humans.coffee

@ -44,7 +44,7 @@ scryptHandler = (resolve, reject) ->
44 44
	# Well, `scrypt` now returns real Error objects. Except now they don't have error codes anymore...
45 45
	return (err, result) ->
46 46
		if err?
47
			errorObj = switch scryptErrorMap[err.message]
47
			errorObj = switch (scryptErrorMap[err.message] ? -1)
48 48
				when 1, 2, 3, 4, 5, 6, 9, 10, 12, 13, -1 then errors.ScryptInternalError
49 49
				when 7, 8 then errors.ScryptInputError
50 50
				when 11 then errors.ScryptPasswordError

+ 2 - 1
lib/scrypt-for-humans.js

@ -65,7 +65,8 @@ scryptHandler = function(resolve, reject) {
65 65
    var errorObj;
66 66
    if (err != null) {
67 67
      errorObj = (function() {
68
        switch (scryptErrorMap[err.message]) {
68
        var _ref;
69
        switch ((_ref = scryptErrorMap[err.message]) != null ? _ref : -1) {
69 70
          case 1:
70 71
          case 2:
71 72
          case 3:

+ 1 - 1
package.json

@ -1,6 +1,6 @@
1 1
{
2 2
  "name": "scrypt-for-humans",
3
  "version": "2.0.0",
3
  "version": "2.0.1",
4 4
  "description": "A human-friendly API wrapper for the Node.js Scrypt bindings.",
5 5
  "main": "index.js",
6 6
  "scripts": {