Vishal G
Vishal G

Reputation: 189

An error has occurred! Error detail not sent by server

I am using asp.net core with boilerplate framework. While implementing save functionality, I am getting "An error has occurred! Error detail not sent by server." error on production server. On debugging, I found that the control gets to .fail() function instead of going to .done() function. The record gets saved into the database and I am getting following message on pop-up : "An error has occurred! Error detail not sent by server."

Following is the jquery used:

this.save = function (modalManager) {
            debugger;
            _$Form = _modalManager.getModal().find('form[name=FormName]');
            var orderTemplateId = $("#orderTemplateId").val();
            var OrderTemplate = _$Form.serializeFormToObject();
            _modalManager.setBusy(true);
            debugger;

            OrderTemplate.id = orderTemplateId;
            var AssignedProductsIds = _findAssignedProductList();
            debugger;
            _orderTemplateService.createOrUpdateOrderTemplate({
                OrderTemplate: OrderTemplate,
                AssignedProductsIds: AssignedProductsIds,
            }).done(function (result) {
                debugger;
                abp.notify.info(app.localize('SavedSuccessfully'));
                _modalManager.close();                
            }).fail(function (result) {
                debugger;                    
                _modalManager.close();
            }).always(function (result) {
                _modalManager.setBusy(false);
                window.location.href = '/app/zone';
            });            
        };

The functionality works perfectly on local server without any errors. So, I am not getting where I am going wrong?

Thanks.

Upvotes: 2

Views: 2727

Answers (2)

Vivek Nuna
Vivek Nuna

Reputation: 1

You can get error details in Logs.txt.

Upvotes: 0

Alper Ebicoglu
Alper Ebicoglu

Reputation: 9634

In OrderTemplateAppService > CreateOrUpdateOrderTemplate() method you should return an output class. And in all cases you have to return the output class. So it could be misbehaving according to your input data.

And this is a sample output what client expects:

{
    "success": true,
    "result": {
        "form": {       
            "formNo": "YYYYYY",
            "serial": "XXXX",
            "productGroup": {
                "name": "LAPTOP"                
            },                      
            "lastModificationTime": "2017-06-20T17:29:13.94",
            "id": 48961
        }
    },
    "error": null,
    "unAuthorizedRequest": false
}

Check the raw response of your method from Chrome Console if you have not added "success" field to the output, probably framework behaves as this method did not succeed

Upvotes: 1

Related Questions