Raise a BadMerkleRootError if the Merkle hash of the
        transactions does not match the Merkle hash included in the block.
766473
def check_merkle_hash(self):
        """"""
        calculated_hash = merkle([tx.hash() for tx in self.txs], double_sha256)
        if calculated_hash != self.merkle_root:
            raise BadMerkleRootError(
                "calculated %s but block contains %s" % (b2h(calculated_hash), b2h(self.merkle_root)))
442087
function isConflictError (err) {
    // return false if err is not an object
    if (typeof err !== 'object') {
        return false
    }
    // return false if error does not have mysql duplicate key code
    if (err.errno !== 1062) {
        return false
    }
    // return false if duplicate key error is not on parent id column
    if (err.message.indexOf(this.model.columnName('parentId')) === -1) {
        return false
    }
    // if all negative tests pass return true
    return true
}
212818
def _raise_fail(self, response, expected):
        
        try:
            if self.logger:
                self.logger.error("Status code "
                                  "{} != {}. \n\n "
                                  "Payload: {}".format(response.status_code,
                                                       expected,
                                                       response.content))
            raise TestStepFail("Status code {} != {}.".format(response.status_code, expected))
        except TestStepFail:
            raise
        except:  # pylint: disable=bare-except
            if self.logger:
                self.logger.error("Status code "
                                  "{} != {}. \n\n "
                                  "Payload: {}".format(response.status_code,
                                                       expected,
                                                       "Unable to parse payload"))
            raise TestStepFail("Status code {} != {}.".format(response.status_code, expected))
516891
def handle_bad_update(operation, ret):
    ''''''
    print("Error " + operation)
    sys.exit('Return code: ' + str(ret.status_code) + ' Error: ' + ret.text)
1070785
function dbError(tx, err) {
            if (calledDBError) {
                return;
            }
            err = idbModules.util.findError(arguments);
            req.readyState = "done";
            req.error = err || "DOMError";
            var e = idbModules.util.createEvent("error");
            e.debug = arguments;
            idbModules.util.callback("onerror", req, e);
            calledDBError = true;
        }
225408
def add_errback(future, callback, loop=None):
    ''''''
    def _error_back(fut):
        if fut._exception:
            callback(fut.exception())
        elif fut.cancelled():
            callback(CancelledError())

    future = ensure_future(future, loop=None)
    future.add_done_callback(_error_back)
    return future
1363562
def check_transaction_threw(client, transaction_hash: bytes):
    
    receipt = client.get_transaction_receipt(transaction_hash)

    if 'status' not in receipt:
        raise ValueError(
            'Transaction receipt does not contain a status field. Upgrade your client',
        )

    if receipt['status'] == RECEIPT_FAILURE_CODE:
        return receipt

    return None
891792
def raise_error
      klass = case @response.to_s
        when "RestClient::BadRequest" then TodaysPlan::BadRequestError
        when "RestClient::Unauthorized" then  TodaysPlan::UnauthorizedError
        when "RestClient::NotFound" then TodaysPlan::NotFoundError
        else
          TodaysPlan::ServerError
        end
      raise klass.new(body['code'], body['message'], body['resolve'])
    end
22478
def with_error_check(client, *response_msg_keys)
      raise "no block" if !block_given?

      begin
        response = yield
        hash_response = response.to_hash
        statuses = hash_response.fetch_in(*response_msg_keys)
        
        if statuses.is_a?(Array)
          all_statuses = statuses
        else
          all_statuses = [statuses]
        end
        
        errors = all_statuses.map{|s| single_error_check(client, s)}.compact
      rescue Exception=>e
        Rews.log{|logger| logger.warn(e)}
        tag_exception(e, :savon_response=>response)
        raise e
      end

      raise Error.new(errors.join("\n")) if !errors.empty?
      statuses
    end
371823
def erratum(id, ip_block, overview = {}, status = {}, sw_workaround = {})
      _errata
      @_errata[id][ip_block][status[:disposition]] = HwErratum.new(id, ip_block, overview, status, sw_workaround)
    end
1283865
private function buildErrorHash($errno, $errfile, $errline, $errstr) {
		return sha1($errno . '-' . $errfile . '-' . $errline . '-' . $errstr);
	}
1162673
def BlockheightCheck(self):
        
        if self.CurrentBlockheight == BC.Default().Height:
            if len(self.Peers) > 0:
                logger.debug("Blockheight is not advancing ...")
                next_hash = BC.Default().GetHeaderHash(self.CurrentBlockheight + 1)
                culprit_found = False
                for peer in self.Peers:
                    if next_hash in peer.myblockrequests:
                        culprit_found = True
                        peer.Disconnect()
                        break

                # this happens when we're connecting to other nodes that are stuck themselves
                if not culprit_found:
                    for peer in self.Peers:
                        peer.Disconnect()
        else:
            self.CurrentBlockheight = BC.Default().Height
751046
void addTransaction(Transaction t, boolean runSanityChecks) {
        unCacheTransactions();
        if (transactions == null) {
            transactions = new ArrayList<>();
        }
        t.setParent(this);
        if (runSanityChecks && transactions.size() == 0 && !t.isCoinBase())
            throw new RuntimeException("Attempted to add a non-coinbase transaction as the first transaction: " + t);
        else if (runSanityChecks && transactions.size() > 0 && t.isCoinBase())
            throw new RuntimeException("Attempted to add a coinbase transaction when there already is one: " + t);
        transactions.add(t);
        adjustLength(transactions.size(), t.length);
        // Force a recalculation next time the values are needed.
        merkleRoot = null;
        hash = null;
    }
432462
def should_skip_middleware(self, middleware, matching, rest) -> bool:
        
        return bool(not matching) or bool(rest)
578388
def check
      raise Errors::ConfigurationInvalid, config.errors.join("; ") unless config.valid?
      distribution.check
    end
314637
function retryOrError(){ 
					if (bRetrying)
						throw Error("unit hash verification failed, unit: "+unit+", objUnit: "+JSON.stringify(objUnit));
					console.log("unit hash verification failed, will retry");
					return setTimeout(function(){
						readJointDirectly(conn, unit, callbacks, true);
					}, 60*1000);
				}
941858
def check_against_chunks(self, chunks):
        # type: (Iterator[bytes]) -> None
        
        gots = {}
        for hash_name in iterkeys(self._allowed):
            try:
                gots[hash_name] = hashlib.new(hash_name)
            except (ValueError, TypeError):
                raise InstallationError('Unknown hash name: %s' % hash_name)

        for chunk in chunks:
            for hash in itervalues(gots):
                hash.update(chunk)

        for hash_name, got in iteritems(gots):
            if got.hexdigest() in self._allowed[hash_name]:
                return
        self._raise(gots)