Skip to main content

Error Handling

Service Request

To send a request in Quick, you need to create an object like the one below.

You can make a request by giving this object as parameter to the Request.async method, provided in the same scope at any time in the page.

responseField (string) : Keeps the name of the field where you can use successful responses from the request.

You can access the response with the name you give to this field after the response keyword. Such as response.{{fieldName}}

data (any) : Body of the request.

onSuccess (string) : Event name to be triggered after successful response from the request.

This event has to be created as a custom event with the same name on the requested component.

onFail (string) : Event name to be triggered fail response from the request.

This event has to be created as a custom event with the same name on the requested component.

Request Sample

quick.EM.trace('Service error');
quick.EM.trace(error);
let requestObject = <any>{};
requestObject.url = 'http://supplierfinance.tekcep.dev.rally.softtech/api/v1/supplierinvoice/invoices/8160477411';
requestObject.http = 'post';
requestObject.data = {};
requestObject.responseField = 'invoices';
requestObject.onSuccess = 'onSuccessInvoices';
requestObject.onFail='onFailInvoices';
quick.Request.async(requestObject);

onFail Event

Data from the error object can be displayed with an alert in the onFail event.

declare var error: any;
quick.EM.trace(error);

quick.Quick.alert(
{
title: error.response?.data?.reasonTitle ?? "HATA",
text: error.response?.data?.reasonDesc ?? "Servis Çağrımında hata oluştu.",

category: 'Error'
});

To see more details on Alert Management, click here.

Pipeline logHandler

In order to access these printed logs, you need to write a custom event called logHandler on the PageComponent in the pipeline.qjson file.

A parameter is sent to this event after each log is printed, depending on the interface below.

interface IMessage {
message: string // Log message
type: string // Debug | MobilDebug | Trace | Warning | Error
time: string // When the browser writes the message
caller?: string // Caller function of the message
}

To see more details on Logging, click here.