1
0
Fork 0
liza/test
Mike Gerwitz 1f66a25658 TokenDao: Better error handling for unknown tokens
Rather than replying with null, which complicates using the returned promise
efficiently, we'll respond with a unique error that allows us to distinguish
between a database failure and a missing token.

These are more traditional errors, but we're moving toward structured
logging, so I want error objects that provide more context.  I'll explore
that a bit more in next commit.  Unfortunately, the untypedness of Promise
rejections make for a less than desirable situation here.  Async/await is
not yet an option since we're still compiling to ES5 (have to support
IE11), and TS compiles async/await into generators for environments that
don't support them, which also are not available in ES5.

* src/server/service/TokenedService.js (_getQuoteToken): Remove null check,
  since this situation can no longer occur.
* src/server/token/MongoTokenDao.ts (getToken): Remove null from return type
  union; reject with `UnknownTokenError' instead.
* src/server/token/TokenDao.ts: Modify interface accordingly.
* src/server/token/UnknownTokenError.ts: New class.
* test/server/token/MongoTokenDaoTest.ts: Modify tests accordingly.  Add
  missing test for latest token namespace missing.
2019-10-17 11:47:14 -04:00
..
bucket Copyright range update 2019-08-30 09:41:35 -04:00
calc Copyright range update 2019-08-30 09:41:35 -04:00
client Copyright range update 2019-08-30 09:41:35 -04:00
conf Add ConfLoader 2017-08-28 09:07:28 -04:00
dapi Copyright range update 2019-08-30 09:41:35 -04:00
document Copyright range update 2019-08-30 09:41:35 -04:00
event FieldVisibilityEventHandler: Fix arrow function notation 2019-10-17 11:47:14 -04:00
field Copyright range update 2019-08-30 09:41:35 -04:00
program Copyright range update 2019-08-30 09:41:35 -04:00
quote Copyright range update 2019-08-30 09:41:35 -04:00
server TokenDao: Better error handling for unknown tokens 2019-10-17 11:47:14 -04:00
store Copyright range update 2019-08-30 09:41:35 -04:00
system Copyright range update 2019-08-30 09:41:35 -04:00
ui Copyright range update 2019-08-30 09:41:35 -04:00
validate [DEV-5657] Check for TLD in email addresses 2019-09-12 09:30:23 -04:00
pre.js Copyright range update 2019-08-30 09:41:35 -04:00