chatbase-node icon indicating copy to clipboard operation
chatbase-node copied to clipboard

how to tell which fields aren't set?

Open dcsan opened this issue 3 years ago • 0 comments

since this library cannot take an object for options, we have to set all the props with functions is there a way to tell which properties are missing?

afaik all have been set

(node:38429) UnhandledPromiseRejectionWarning: Error: One or more required fields were not set on the message, please check the documentation on how to set the following message fields:
api_key, type, user_id, time_stamp, platform, message
    at MessageStateWrapper.exportCreatePayload (/Users/dc/dev/ten/xbot/server/node_modules/@google/chatbase/lib/MessageSink.js:430:14)
    at /Users/dc/dev/ten/xbot/server/node_modules/@google/chatbase/lib/MessageStateWrapper.js:145:29
    at new Promise (<anonymous>)

to make the library more usable:

  • error messages should be more precise - what fields weren't set?
  • allow to set all options eg msg.setOptions(opts)
  • at least inspect the options that are set? const obj = msg.getOptions()

otherwise it's just tedious trial and error to use this thing.

dcsan avatar Nov 15 '20 06:11 dcsan