better err msg
This commit is contained in:
parent
d1b6b238bf
commit
72ff9eb21a
1 changed files with 8 additions and 2 deletions
|
|
@ -23,7 +23,10 @@ const IS_GUN_AUTH = 'IS_GUN_AUTH'
|
|||
|
||||
mySEA.encrypt = (msg, secret) => {
|
||||
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) {
|
||||
|
|
@ -42,7 +45,10 @@ mySEA.encrypt = (msg, secret) => {
|
|||
|
||||
mySEA.decrypt = (encMsg, secret) => {
|
||||
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) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue