[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();
message = authException.getMessage();
} catch (Exception e) {
Matcher matcher = Pattern.compile("\\[(.*?)\\]").matcher(message);
Matcher matcher = Pattern.compile("\\[(.*):.*\\]").matcher(message);
if (matcher.find()) {
code = matcher.group().substring(2, matcher.group().length() - 2).trim();
code = matcher.group(1).trim();
switch (code) {
case "INVALID_CUSTOM_TOKEN":
message = "The custom token format is incorrect. Please check the documentation.";