From 491b61afad39fb684c2ce45ae224da7b85614a9c Mon Sep 17 00:00:00 2001 From: Salakar Date: Mon, 14 Aug 2017 18:43:21 +0100 Subject: [PATCH] [js][database] nativeToJSError util can now attach addition props to the error - e.g. ref path --- lib/utils/index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/utils/index.js b/lib/utils/index.js index cf10f401..e0ac47b1 100644 --- a/lib/utils/index.js +++ b/lib/utils/index.js @@ -290,11 +290,13 @@ export function generatePushID(serverTimeOffset?: number = 0): string { * Converts a code and message from a native event to a JS Error * @param code * @param message + * @param additionalProps * @returns {Error} */ -export function nativeToJSError(code: string, message: string) { +export function nativeToJSError(code: string, message: string, additionalProps?: Object = {}) { const error = new Error(message); error.code = code; + Object.assign(error, additionalProps); return error; }