[js][database] nativeToJSError util can now attach addition props to the error - e.g. ref path
This commit is contained in:
parent
c6a26606d1
commit
491b61afad
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user