better err msg

This commit is contained in:
Daniel Lugo 2020-01-29 11:58:25 -04:00
parent d1b6b238bf
commit 72ff9eb21a

View file

@ -23,7 +23,10 @@ const IS_GUN_AUTH = 'IS_GUN_AUTH'
mySEA.encrypt = (msg, secret) => { mySEA.encrypt = (msg, secret) => {
if (typeof msg !== 'string') { if (typeof msg !== 'string') {
throw new TypeError('mySEA.encrypt() -> expected msg to be an string') throw new TypeError(
'mySEA.encrypt() -> expected msg to be an string instead got: ' +
typeof msg
)
} }
if (msg.length === 0) { if (msg.length === 0) {
@ -42,7 +45,10 @@ mySEA.encrypt = (msg, secret) => {
mySEA.decrypt = (encMsg, secret) => { mySEA.decrypt = (encMsg, secret) => {
if (typeof encMsg !== 'string') { if (typeof encMsg !== 'string') {
throw new TypeError('mySEA.encrypt() -> expected encMsg to be an string') throw new TypeError(
'mySEA.encrypt() -> expected encMsg to be an string instead got: ' +
typeof encMsg
)
} }
if (encMsg.length === 0) { if (encMsg.length === 0) {