Exemple #1
0
        private AuthEventEnum GetAuthEventEnumForJsError(JSException e)
        {
            string message = e.Message.Split((char)10)[0]; // we just want the first part of the message returned.

            Debug.WriteLine(message);
            switch (message)
            {
            case "UserNotFoundException": return(AuthEventEnum.Alert_UserNotFound);

            case "UsernameExistsException": return(AuthEventEnum.Alert_LoginAlreadyUsed);

            case "InvalidParameterException": return(AuthEventEnum.Alert_InternalProcessError);

            case "InvalidPasswordException": return(AuthEventEnum.Alert_PasswordFormatRequirementsFailed);

            case "TooManyRequestsException": return(AuthEventEnum.Alert_TooManyAttempts);

            case "TooManyFailedAttemptsException": return(AuthEventEnum.Alert_TooManyAttempts);

            case "NotAuthorizedException": return(AuthEventEnum.Alert_NotAuthorized);

            case "UserNotConfirmedException": return(AuthEventEnum.Alert_NotConfirmed);

            case "CodeMismatchException": return(AuthEventEnum.Alert_VerifyFailed);

            case "AliasExistsException": return(AuthEventEnum.Alert_AccountWithThatEmailAlreadyExists);

            case "LimitExceededException": return(AuthEventEnum.Alert_LimitExceededException);

            default: return(AuthEventEnum.Alert_Unknown);
            }
        }
Exemple #2
0
        /// <summary>
        /// Try extract more details, return richer error data os <paramref name="error"/>.
        /// </summary>
        public static JSException TryUnwrap(JSException error)
        {
            var idxLine1 = error.Message.IndexOf('\n');

            if (idxLine1 <= 0)
            {
                return(null);
            }

            var line1 = error.Message.Substring(0, idxLine1);

            if (line1.First() != '{' || line1.Last() != '}')
            {
                return(null);
            }

            try
            {
                var data = JsonSerializer.Deserialize <ErrorData>(line1);

                if (data.Name == nameof(DOMException))
                {
                    return(new DOMException(data, error));
                }

                return(new StandardError(data, error));
            }
            catch (JsonException)
            {
                /*not json data*/
            }

            return(null);
        }
Exemple #3
0
 private void HandleJSError(JSException ex)
 {
     UnityEngine.Debug.LogError(ex);
     if (Configurations.Debugging)
     {
         string dump = FormatCodeInfo(threadContext.DumpMessage());
         UnityEngine.Debug.Log(dump);
         LogToFile("[JSERROR]" + (" Recent code:" + dump + '\n') + ex.Message);
     }
     else
     {
         LogToFile("[JSERROR]" + ex.Message);
     }
 }
 void JSContext.IJSExceptionHandler.Handle(JSException p0)
 {
     action(p0);
 }
Exemple #5
0
 public StandardError(EnrichError.ErrorData data, JSException inner)
     : base(data.Message, inner)
 {
     Name = data.Name;
 }
 public DOMException(EnrichError.ErrorData data, JSException inner)
     : base(data.Message, inner)
 {
     Name = data.DomErrorName;
 }