Cleanup utils

This commit is contained in:
Elliot Hesp 2017-05-27 17:31:00 +01:00
parent e4ee402aef
commit 5b39ab3efe
1 changed files with 7 additions and 5 deletions

View File

@ -31,11 +31,7 @@ const _handler = (resolve, reject, errorPrefix, err, resp) => {
export function nativeSDKMissing(sdkName) {
if (Platform.OS === 'ios') {
console.warn(`Firebase ${sdkName} native sdk has not been included in your podfile - ${sdkName} methods have been disabled.`);
} else {
console.warn(`Firebase ${sdkName} native sdk has not been included in your build.gradle file - ${sdkName} methods have been disabled.`);
}
console.warn(`Firebase ${sdkName} native sdk has not been included in your ${Platform.OS === 'ios' ? 'podfile' : 'build.gradle'} - ${sdkName} methods have been disabled.`);
}
export function toWebSDKErrorCode(code: any, prefix: string): string {
@ -327,6 +323,12 @@ export function generatePushID(serverTimeOffset?: number = 0): string {
return id;
}
/**
* Converts a code and message from a native event to a JS Error
* @param code
* @param message
* @returns {Error}
*/
export function nativeToJSError(code: string, message: string) {
const error = new Error(message);
error.code = code;