onReceiveError
onReceiveError
Called when the response to a request comes back as an error.
Parameters
provInstName(string): The name of the Provider Instance that sent the requestcode(string): The error codemessage(string): The error message
Returns: No return value — this is a callback, so its return value isn't used.
Description
Called when a request ends in failure — a network failure, a server error response. It's the right place to show an error toast or write retry logic.
Example
function onReceiveError(provInstName, code, message) {
$log.i(provInstName + " error " + code + ": " + message);
}
Related
onReceiveDone(provInstName, isSuccess)also fires on failure, but it only reportsisSuccess— no error code or message. UseonReceiveErrorwhen you need the reason.- Even when this function runs,
onReceiveDoneis still called separately withisSuccess=false— both can fire for the same failure. onCheckUpdateValid,onResponseUpdateBefore, andonResponseUpdateAfterdo not run on this path; those three belong to the success path only.onDataMessagehaving already fired doesn't by itself mean the request failed — the two are independent notifications.