1f66a25658
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. |
||
---|---|---|
.. | ||
db | ||
meta | ||
quote | ||
request | ||
service | ||
token |