Base solution for your next web application
Open Closed

Unable to find cause of Client Error!!! #2711


User avatar
0
kacey created

I have a particular method I am calling through angularJS to display some data from the database, but doing so, I get an error that states "An Error has occurred. Error detailed not Sent by the server." I confirmed it by debugging the method and discovered it works just fine and retrieves the data, but when it's time to display on the client, this happens. I have opened the browser console to check what is happening, but the error is not logged there either. If Only I can know what the problem is exactly, it would be so much better. See my code below;

C#

public PagedResultDto<GoodsRequestDto> GetGoodsRequestPaged(GoodsRequestListInput input)
        {
            var goodsRequests = _goodsRequestRepo.GetAllIncluding(g => g.GoodsQuotes)
                .WhereIf(input.UserId.HasValue, g => g.CreatedBy == input.UserId)
                .OrderBy(d => d.Id)
                .PageBy(input)
                .ToList();

            return new PagedResultDto<GoodsRequestDto>
            {
                TotalCount = goodsRequests.Count,
                Items = goodsRequests.MapTo<List<GoodsRequestDto>>()
            };
        }
    }

AngularJS

vm.loadGoodsRequests = function () {
                var skipCount = 0;

                abp.ui.setBusy(null,
                    projectService.getGoodsRequestPaged({
                        skipCount: skipCount,
                        userId: appSession.user.id
                    }).success(function (data) {
                        vm.goodsRequests = data.items;
                    })
                );
            }

HTML

<div ng-if="vm.goodsRequests.length" ng-repeat="gr in vm.goodsRequests" class="classInfo-list-item col-md-6">
            <div class="classInfo-body">
                <h3 class="classInfo-title">
                    {{gr.categoryItem.name + "_" + gr.brand.name + "_" + gr.product.name | cut:true:50:' ...'}}
                </h3>
                <p class="classInfo-description">Quantity: {{gr.quantity}} {{gr.unit}}</p>
                <p class="classInfo-description">Payment Term: {{gr.paymentTerm}}</p>
                <div class="classInfo-registration-info">
                    {{gr.goodsQuotes.length}} Quote(s).
                </div>
                <div class="classInfo-actions">
                    <a class="btn btn-sm btn-info" ng-href="#/my-goods-requests/{{gr.id}}">@L("Details") <i class="fa fa-arrow-circle-right"></i></a>
                </div>
                <span ng-class="vm.statusClass(gr.statusString)" class="classInfo-date"> {{gr.statusString }}</span>
            </div>
        </div>

I used similar approach for other pages of the application and I didn't get any such problem. I don't know what I'm doing wrong and worst of all, I don't know the exact cause of the error.

Please Help! I've been on this for hours. I checked the Logs.txt file, Browser Console no error to describe what the problem is.


4 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    I think the data is not reached to client side, right ? If so, can you share your entity and dto (GoodsRequestDto) ?

    Thanks.

  • User Avatar
    0
    kacey created

    Sure.

    GoodsRequest Entity

    public class GoodsRequest : FullAuditedEntity
        {
            public int CategoryId { get; set; }
    
            public int CategoryItemId { get; set; }
    
            public int? BrandId { get; set; }
    
            public string PreferredBrand { get; set; }
    
            public int ProductId { get; set; }
    
            public int Quantity { get; set; }
    
            [StringLength(10, MinimumLength = 2)]
            public string Unit { get; set; }
    
            [StringLength(50, MinimumLength = 10)]
            public string PaymentTerm { get; set; }
    
            public bool ShouldBeDelivered { get; set; }
    
            [StringLength(150)]
            public string DeliveryLocation { get; set; }
    
            public long CreatedBy { get; set; }
    
            [NotMapped]
            public GoodsRequestStatus Status { get; set; }
    
            [Column("Status")]
            public string StatusString
            {
                get
                {
                    return Status.ToString();
                }
                private set
                {
                    Status = value.ParseEnum<GoodsRequestStatus>();
                }
            }
    
            public virtual Category Category { get; set; }
    
            public virtual CategoryItem CategoryItem { get; set; }
    
            public virtual Brand Brand { get; set; }
    
            public virtual Product Product { get; set; }
    
            public virtual User UserCreator { get; set; }
    
            public virtual ICollection<GoodsQuote> GoodsQuotes { get; set; }
        }
    

    GoodsRequestDto

    [AutoMapFrom(typeof(GoodsRequest))]
        public class GoodsRequestDto : FullAuditedEntityDto
        {
            public int CategoryId { get; set; }
    
            public int CategoryItemId { get; set; }
    
            public int? BrandId { get; set; }
    
            public string PreferredBrand { get; set; }
    
            public int ProductId { get; set; }
    
            public int Quantity { get; set; }
    
            public string Unit { get; set; }
    
            public string PaymentTerm { get; set; }
    
            public bool ShouldBeDelivered { get; set; }
            
            public string DeliveryLocation { get; set; }
    
            public long CreatedBy { get; set; }
    
            public GoodsRequestStatus Status { get; set; }
    
            public string StatusString { get; private set; }
            
    
            public virtual CategoryDto Category { get; set; }
    
            public virtual CategoryItemDto CategoryItem { get; set; }
    
            public virtual BrandDto Brand { get; set; }
    
            public virtual ProductDto Product { get; set; }
    
            public virtual UserListDto UserCreator { get; set; }
    
            public virtual ICollection<GoodsQuoteDto> GoodsQuotes { get; set; }
        }
    
  • User Avatar
    0
    kacey created

    Please I need help with this problem. It's delaying delivery of a proof of concept I'm creating. Please can someone suggest how I can get to the root of this? The data is gotten from the web api but on getting to the client, the error comes up. No message is logged on the console neither is it written to the

    log.txt
    

    file.

    PLEASE HELP!

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    I suggest you to comment fields of your DTO one by one and try to see if data reaches to client. Probably one of the fields in your DTO causes this problem.