0

Using the Quick Start from the Domino AppDev Pack documentation, I get an error:

(node:46496) UnhandledPromiseRejectionWarning: Error
    at new DominoDbError (C:\Users\tbahn\AppData\Roaming\npm\node_modules\@domino\domino-db\src\domino-db-error.js:6:16)
    at wrapError (C:\Users\tbahn\AppData\Roaming\npm\node_modules\@domino\domino-db\src\requests\grpc\utils\grpc-helpers.js:124:10)
    at client.bulkNote (C:\Users\tbahn\AppData\Roaming\npm\node_modules\@domino\domino-db\src\requests\grpc\utils\bulk-document.js:157:18)
    at Object.onReceiveStatus (C:\Users\tbahn\AppData\Roaming\npm\node_modules\@domino\domino-db\node_modules\grpc\src\client_interceptors.js:1189:9)
    at InterceptingListener._callNext (C:\Users\tbahn\AppData\Roaming\npm\node_modules\@domino\domino-db\node_modules\grpc\src\client_interceptors.js:564:42)
    at InterceptingListener.onReceiveStatus (C:\Users\tbahn\AppData\Roaming\npm\node_modules\@domino\domino-db\node_modules\grpc\src\client_interceptors.js:614:8)
    at callback (C:\Users\tbahn\AppData\Roaming\npm\node_modules\@domino\domino-db\node_modules\grpc\src\client_interceptors.js:841:24)
(node:46496) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:46496) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Error occurs in line:

const response = await database.bulkCreateDocuments(createOptions);

Same error I get in the example code of the database.bulkReadDocuments.

leonheess
  • 16,068
  • 14
  • 77
  • 112

1 Answers1

1

To find better error messages, you should catch the error being thrown.

try {
  const response = await database.bulkCreateDocuments(createOptions);
} catch (e) {
  console.error(e);
}
ddumont
  • 583
  • 3
  • 14
  • Hi Dan, thank you. I added the catch, but in another way: `useServer(serverConfig).then(...).catch(err => console.error(err));` – Thomas Bahn - assono GmbH Mar 26 '19 at 19:42
  • I tried to format the last comment as code with line breaks for abou 10 min. :-( – Thomas Bahn - assono GmbH Mar 26 '19 at 19:43
  • I spoke with John Curtis today and suggested to add a minimal error handling to the code blocks (each codeblock) in the documentation. The reasoning behind this idea: People new to the subject tend to copy and paste code from the documentation **and** to make mistakes. With adding minimal error handling, they will faster the information needed to fix their bug. – Thomas Bahn - assono GmbH Mar 26 '19 at 19:44
  • In production code I probably use more try-catch-blocks to have a more specific error message and perhaps even could retry after a second (network hickup). – Thomas Bahn - assono GmbH Mar 26 '19 at 19:48
  • Not a bad idea. I'll add it to our backlog. – ddumont Mar 28 '19 at 18:52