No error' property on response object of error callback for makeConsultCall

Version 1
    This document was generated from CDN thread

    Created by: Miguel Cubias on 03-01-2014 04:20:40 PM
    Good day.I'm currently developing a gadget which allows the user to make a consult call. The consult actions is performed correctly. but when I want to handle the error callback (lets suppose the user enters the same extension as his) the response object of the function doesn't have the error property (as specified in the javascript documentation, attached a screenshot in which I base my question)

    Could you please help me telling me how can I get the error message thrown by the makeConsultCall? I got the other properties (status, content and object) but no error  property. I want to access the errorType and errorMessage to be displayed to the user.

    Hope you can help me with this regards
    Thanks in advance

    Subject: RE: No error' property on response object of error callback for makeConsult
    Replied by: Juan Othmaro Menjivar on 06-01-2014 01:40:36 PM
    Hello David/Joseph,

    Can you please help us out by confirming what's going on about this request?

    Subject: RE: No error' property on response object of error callback for makeConsult
    Replied by: David Lender on 06-01-2014 01:52:43 PM
    You access the rsp object which should have an ApiErrors object and is accessed:
     
    apiError = rsp.object.ApiErrors.ApiError;
    errorCode = apiError.ErrorData;
    errorType = apiError.ErrorType;
    errorMsg = apiError.ErrorMessage;

    Here's my makeconsultcall error hander:
     1makeConsultCallError = function(rsp) {
     2 
     3   clientLogs.log ("makeConsultCallError()");
     4  
     5  errorType = rsp.object.ApiErrors.ApiError.ErrorType;
     6  errorMessage = rsp.object.ApiErrors.ApiError.ErrorMessage;
     7  
     8  clientLogs.log ("makeConsultCallError() - errorType: " + errorType);
     9  clientLogs.log ("makeConsultCallError() - errorMessage: " + errorMessage);
    10  
    11    },
    12    

    Also, you will get an error response if you use the agent’s own extension as a target of the consult.
     
    errorType: Invalid Destination
    errorMessage: 'toAddress' cannot be same as 'targetMediaAddress'