js: throw errors in sync functions
authorMaximilian Krambach <maximilian.krambach@intevation.de>
Wed, 22 Aug 2018 10:18:55 +0000 (12:18 +0200)
committerMaximilian Krambach <maximilian.krambach@intevation.de>
Wed, 22 Aug 2018 10:18:55 +0000 (12:18 +0200)
commit93f674d33d4dacb115398196a7218c28323fd708
tree56f3169f96f36dbbc682b06dfcf2c28cf9c0b5ff
parent6d720137dd9564931bf313a7e7078e63fb00287c
js: throw errors in sync functions

--

* synchronous functions should throw errors if something goes wrong,
  Promises should reject. This commit changes some error cases that
  returned Error objects instead of throwing them

  - src/Key.js: createKey() and sync Key.get() throw errors
  - src/Error.js: Exporting the list of errors to be able to test and
    compare against these strings
  - src/Keyring.js: Setting a null value in pattern is not useful, and
    now caused an error with the new changes.
  - src/Message.js: createMessage and Message.setParameter now throw
    errors
lang/js/src/Errors.js
lang/js/src/Key.js
lang/js/src/Keyring.js
lang/js/src/Message.js
lang/js/src/gpgmejs.js
lang/js/unittests.js