Handle contract call error
@function
@alias module:@aeternity/aepp-sdk/es/ae/contract
@category async
@param {Object} result call result object
@throws Error Decoded error
@return {Promise<void>}
161273
async function handleCallError (result) {
  const error = Buffer.from(result.returnValue).toString()
  if (isBase64(error.slice(3))) {
    const decodedError = Buffer.from(error.slice(3), 'base64').toString()
    throw Object.assign(Error(`Invocation failed: ${error}. Decoded: ${decodedError}`), R.merge(result, { error, decodedError }))
  }

  const decodedError = await this.contractDecodeData('string', error)
  throw Object.assign(Error(`Invocation failed: ${error}. Decoded: ${decodedError}`), R.merge(result, { error, decodedError }))
}
150164
function (method, result) {

      // result should not be undefined
      if (result === undefined) {
        console.warn('JSON-RPC2 response from method ' + methodName + ' should return a result. (JSON-RPC2 spec)')
        result = ''
      }

      var rpcMessage = {
        jsonrpc: '2.0',
        result: result,
        id: id
      }

      callback(rpcMessage)
      responseHasBeenSent = true

    }
146988
public void handleResult(TaskCommand<String,String> taskCommand, String result){

		/**
		if(result == null){
			error(  taskCommand,   result);
			return ;
		}
		int errorStartIdx = result.indexOf("\"errors\":");
		if(errorStartIdx < 0) {
			error(taskCommand, result);
			return;
		}
		int errorEndIdx = result.indexOf(",",errorStartIdx);
		if(errorEndIdx < 0){
			error(taskCommand, result);
			return;
		}
		String errorInfo = result.substring(errorStartIdx,errorEndIdx);
		if(errorInfo.equals("\"errors\":false")){
			success(  taskCommand,   result);
		}
		else{
			error(  taskCommand,   result);

		}
		 */
		if(!ResultUtil.bulkResponseError(result)){
			success(  taskCommand,   result);
		}
		else{
			error(  taskCommand,   result);
		}

	}
925087
def _handle_result(self, result):
        
        is_ephemeral = result.node.is_ephemeral_model
        if not is_ephemeral:
            self.node_results.append(result)

        node = CompileResultNode(**result.node)
        node_id = node.unique_id
        self.manifest.nodes[node_id] = node

        if result.error is not None:
            if is_ephemeral:
                cause = result
            else:
                cause = None
            self._mark_dependent_errors(node_id, result, cause)
463456
function handleCallback(query, q, model, resultsPerPage, callback) {
  return async.parallel({
    results: function(callback) {
      query.exec(callback);
    },
    count: function(callback) {
      model.count(q, function(err, count) {
        callback(err, count);
      });
    }
  }, function(error, data) {
    if (error) {
      return callback(error);
    }
    callback(null, data.results, Math.ceil(data.count / resultsPerPage) || 1, data.count);
  });
}
1203956
function (web3Provider, result) {
    return new Promise(function (onResolve, onReject) {
      onResolve(web3Provider.utils.hexToNumber(result));
    });
  }
432934
@Override
    public void handleResult(RHI result) {
        if (wrappedResultHandler != null) {
            wrappedResultHandler.handleResult(resultTransformer.transform(result));
        }
    }
668851
protected void handlePendingCallResult(RTMPConnection conn, Invoke invoke) {
        final IServiceCall call = invoke.getCall();
        final IPendingServiceCall pendingCall = conn.retrievePendingCall(invoke.getTransactionId());
        if (pendingCall != null) {
            // The client sent a response to a previously made call.
            Object[] args = call.getArguments();
            if (args != null && args.length > 0) {
                // TODO: can a client return multiple results?
                pendingCall.setResult(args[0]);
            }
            Set<IPendingServiceCallback> callbacks = pendingCall.getCallbacks();
            if (!callbacks.isEmpty()) {
                HashSet<IPendingServiceCallback> tmp = new HashSet<>();
                tmp.addAll(callbacks);
                for (IPendingServiceCallback callback : tmp) {
                    try {
                        callback.resultReceived(pendingCall);
                    } catch (Exception e) {
                        log.error("Error while executing callback {}", callback, e);
                    }
                }
            }
        }
    }
212036
private void throwResult(final Result result) {
		this.executor.execute(new Runnable() {
			
			@Override
			public void run() {
				QConnectorAsyncImpl.this.listener.resultReceived("", result);
			}
		});
	}
145696
function _handleResult(callback, err, res) {
    return callback(null, {
        error:  err,
        result: res
    });
}
1348690
public void complete( T result, Object error ) {
        synchronized (this) {
            if ( isComplete ) {
                throw new RuntimeException("Promise can be completed only once");
            }
            this.result = result;
            this.error = error;
            isComplete = true;
            tryFire();
        }
    }
354224
function(promise, xhrResult) {
		var error = xhrResult;
		try {
			error = JSON.parse(xhrResult.responseText);
		} catch (e) {}
		if (error && error.DetailedMessage) {
			error = i18nUtil.formatMessage(messages["Err"], error.DetailedMessage);
		} else if (error && error.Message) {
			error = i18nUtil.formatMessage(messages["Err"], error.Message);
		} else if (typeof xhrResult.url === "string") {
			if (xhrResult.status === 0) {
				error = i18nUtil.formatMessage(messages["NoResponseFromServer"], xhrResult.url);
			} else {
				error = i18nUtil.formatMessage(messages["ServerError"], xhrResult.url, xhrResult.status, xhrResult.statusText);
			}
		}
		var errNode = document.createElement("span"); //$NON-NLS-0$
		errNode.textContent = error;
		promise.reject(errNode);
	}
849783
function(error) {
      if (this._resolved || this._rejected) {
        throw "A promise was rejected even though it had already been " +
          (this._resolved ? "resolved" : "rejected") + ".";
      }
      this._rejected = true;
      this._error = error;
      Parse._arrayEach(this._rejectedCallbacks, function(rejectedCallback) {
        rejectedCallback(error);
      });
      this._resolvedCallbacks = [];
      this._rejectedCallbacks = [];
    }
529833
protected function throwExceptionOnClientCallFailure($result)
    {
        if ($result !== false) {
            return;
        }

        throw new OperationFailed(
            $this->client->getResultMessage(),
            $this->client->getResultCode()
        );
    }
472974
function dispatchResult (error, data) {
    if (_cb.beforeAll) { _cb.beforeAll() }

    if (_cb.returnForAll) {
      _cb.returnForAll(error, data)
    } else if (!_isNullOrEmptyArray(error)) {
      var _error = _normalizeError(error)
      if (!_isNullOrEmptyArray(data)) {
        processErrorAndData(_error, data)
      } else {
        processError(_error)
      }
    } else {
      if (!_isNullOrEmptyArray(data)) {
        processData(data)
      } else {
        processNotFound()
      }
    }

    if (_cb.afterAll) { _cb.afterAll() }
  }
53003
function call(method, key) {
    if (!exports.results.has(method))
        create(method); // create as needed
    const methodCache = exports.results.get(method);
    let callResults;
    if (methodCache.has(key)) {
        log_1.logger.debug(`[${method}] Calling (cached): ${key}`);
        // return from cache if key has been used on method before
        callResults = methodCache.get(key);
    }
    else {
        // call and cache for next time, returning results
        log_1.logger.debug(`[${method}] Calling (caching): ${key}`);
        callResults = exports.instance.call(method, key).result;
        methodCache.set(key, callResults);
    }
    return Promise.resolve(callResults);
}
752540
function responseHandler(err, res) {
            //console.log('resp', err, res.status);
            // Handle connection HTTPS errors.
            if (err){
                d.reject(err);
            }else {
                var answer = {
                    code: res.status,
                    headers: res.headers,
                    data: res.body
                };

                // Check if response is IDOL API error or not
                if (res.status < 200 || res.status >= 300) {
                    // YES it is error.
                    // Resolve the promise with the error.
                    d.reject(answer);
                } else {
                    // NO it is not error.
                    // Queue the job for polling if it is async job.
                    if (options.type == 'async' && Boolean(self.options.autoResult)) {
                        self
                            .jobResult(res.body.jobID)
                            .done(
                                _.partial(self.emit, 'job result'),
                                _.partial(self.emit, 'job result error')
                        );
                    }
                    // Resolve the promise with the result.
                    d.resolve(answer);
                }
            }
        }