Ejemplo n.º 1
0
        public async Task <IActionResult> Confirm(string userId)
        {
            try
            {
                var responseOnConfirm = await _handler.Confirm(userId);

                return(StatusCode(StatusCodes.Status202Accepted, responseOnConfirm.ToString()));
            }
            catch (ServerException e)
            {
                return(StatusCode(StatusCodes.Status500InternalServerError, new ErrorResponse(error: "Internal server error", errorMessage: e.ToString()).ToString()));
            }
            //TODO: Add general exception if needed. Here there-s a System.FormatException: '6071bd6e3f4909a7120824e21' is not a valid 24 digit hex string.
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Confirm(string userId)
        {
            try
            {
                var responseOnConfirm = await _handler.Confirm(userId);

                return(StatusCode(StatusCodes.Status202Accepted, responseOnConfirm.ToString()));
            }
            catch (Exception e)
            {
                if (e is FormatException)
                {
                    return(BadRequest(new ErrorResponse(error: Text.InvalidConfirmationString(userId)).ToString()));
                }
                if (e is ServerException)
                {
                    return(StatusCode(StatusCodes.Status500InternalServerError, new ErrorResponse(error: Text.ServerException, errorMessage: e.ToString()).ToString()));
                }
                return(StatusCode(StatusCodes.Status500InternalServerError, new ErrorResponse(error: Text.InternalServerError, errorMessage: e.ToString()).ToString()));
            }
        }