[android][auth] Update code regex pattern to handle messages contained within the code brackets

This commit is contained in:
Elliot Hesp 2017-06-15 12:47:40 +01:00
parent 87eb76520e
commit 840f6b0ced
1 changed files with 2 additions and 2 deletions

View File

@ -718,9 +718,9 @@ public class RNFirebaseAuth extends ReactContextBaseJavaModule {
code = authException.getErrorCode(); code = authException.getErrorCode();
message = authException.getMessage(); message = authException.getMessage();
} catch (Exception e) { } catch (Exception e) {
Matcher matcher = Pattern.compile("\\[(.*?)\\]").matcher(message); Matcher matcher = Pattern.compile("\\[(.*):.*\\]").matcher(message);
if (matcher.find()) { if (matcher.find()) {
code = matcher.group().substring(2, matcher.group().length() - 2).trim(); code = matcher.group(1).trim();
switch (code) { switch (code) {
case "INVALID_CUSTOM_TOKEN": case "INVALID_CUSTOM_TOKEN":
message = "The custom token format is incorrect. Please check the documentation."; message = "The custom token format is incorrect. Please check the documentation.";