Skip to main content

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 request
  • code (string): The error code
  • message (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 reports isSuccess — no error code or message. Use onReceiveError when you need the reason.
  • Even when this function runs, onReceiveDone is still called separately with isSuccess=false — both can fire for the same failure.
  • onCheckUpdateValid, onResponseUpdateBefore, and onResponseUpdateAfter do not run on this path; those three belong to the success path only.
  • onDataMessage having already fired doesn't by itself mean the request failed — the two are independent notifications.