입력된 필드가 숫자가 아닐 경우 exception
@param $field
@param string $msg
@throws \Ridibooks\Exception\MsgException
510786
public static function checkNumberField($field, $msg)
    {
        if ((StringUtils::isEmpty($field) === false) && !is_numeric($field)) {
            throw new MsgException($msg);
        }
    }
747627
private function performCount($field = '*') {
        try {
            $this->checkDialect();
        } catch (DialectException $e) {
            $this->error          = $e->getMessage();
            $this->count          = 0;
            $this->errorSQL       = '';
            $this->errorValues    = null;
            $this->countperformed = true;

            return;
        }
        $this->count = false;
        $values      = new BindValues ();
        $fields [0]  = 'COUNT(' . $field . ')';
        $fields      = $this->prepareFields($fields, $values);
        $from        = $this->prepareFrom($this->sanitize($this->from));
        $joins       = $this->prepareJoins($this->sanitize($this->joins));
        $having      = $this->sanitize($this->having);
        $group       = $this->sanitize($this->group);
        $sql         = $this->dialect->getCountSelectSQL($fields, $from, $joins, $this->where, $having, $group, $values);
        if ($sql) {
            try {
                $this->options [ \PDO::ATTR_CURSOR ] = \PDO::CURSOR_SCROLL;
                $statement                           = $this->dialect->prepare($sql, $this->options);
                if ($values) {
                    foreach ($values as $value) {
                        list ($name, $val, $type, $field) = $value;
                        if ($this->whereData) {
                            $val = isset($this->whereData[ $field ]) ? $this->whereData[ $field ] : (isset($this->whereData[ $name ]) ? $this->whereData[ $name ] : $val);
                        }
                        if (!$statement->bindValue($name, $val, $type)) {
                            $this->countperformed = true;
                            $this->count          = 0;
                            $this->errorSQL       = $sql;
                            $this->errorValues    = $values->__toString();
                            $this->error          = 'can not bind the value ' . $val . '[' . $type . '] to the argument:' . $name;

                            return;
                        }
                    }
                }
                $rst = $statement->execute();
                QueryBuilder::addSqlCount();
                if ($rst) {
                    $resultSet = $statement->fetch(\PDO::FETCH_NUM);
                    $statement->closeCursor();
                    $this->count = intval($resultSet [0]);
                } else {
                    $this->dumpSQL($statement);
                }
            } catch (\PDOException $e) {
                $this->error       = $e->getMessage();
                $this->count       = 0;
                $this->errorSQL    = $sql;
                $this->errorValues = $values->__toString();
            }
        } else {
            $this->count       = 0;
            $this->errorSQL    = '';
            $this->errorValues = $values->__toString();
            $this->error       = 'can not generate the SQL';
        }
        $this->countperformed = true;
    }
596154
function error($msg, $section = 'bors', $trace = false, $extra = array())
	{
		static $entered = false;
		if($entered)
			throw new Exception('Reentered logger with '.$msg.' in section '.$section);

		$entered = true;

		try
		{
			$this->logger($section, Logger::ERROR, $trace)->addError($msg, $extra);
		}
		catch(Exception $e)
		{
			echo "Exception while error logging:\n<code><xmp>".$e->getMessage()."</xmp></code>\nFirst error is:\n<xmp>$msg\nin".bors_debug::trace()."</xmp>";
		}

		$entered = false;
	}
373426
public static void throww(Throwable e, String msg) {
		if (e instanceof RuntimeException) {
			throw (RuntimeException) e;
		}
		throw new JKException(msg, e);
	}
1054368
protected function throwNewInvalidArgumentException ($errorMsg) {
		$selfClass = version_compare(PHP_VERSION, '5.5', '>') ? self::class : __CLASS__;
		$str = '['.$selfClass.'] ' . $errorMsg . ' (';
		if ($this->form) {
			$str .= 'form id: `'.$this->form->GetId() . '`, '
				. 'form type: `'.get_class($this->form).'`, ';
		}
		$str .= 'field type: `'.get_class($this) . '`)';
		throw new \InvalidArgumentException($str);
	}
571124
private function afterFetch($r, $fieldId,$msg) {
		if (!$this->isMissing) {
			if ($this->ifFailThenOrigin) {
				$this->default = $r;
			}
			if (!$this->isArray) {
				$this->originalValue = $r;
				$r = $this->basicValidation($r, $fieldId, $msg);
			} else {
				$this->originalValue = $r;
				if (is_array($r) || $r === null) {
					if ($r !== null) {
						foreach ($r as $key => &$v) {
							$currentField = ($this->isArrayFlat) ? $fieldId : $fieldId . "[" . $key . "]";
							$v = $this->basicValidation($v, $currentField, $msg, $key);
						}
					}
				} else {
					$this->addMessageInternal('%field is not an array', '', $fieldId, 0, 'error');
				}
			}
			if ($this->isArray) {
				if (is_array($r)) {
					foreach ($r as $key => &$items) {
						$currentField = ($this->isArrayFlat) ? $fieldId : $fieldId . "[" . $key . "]";
						$this->runConditions($items, $currentField, $key);

						if ($this->ifFailThenDefault) {
							if ($this->messageList->get($currentField)->countError())
								$items = (is_array($this->default)) ? $this->default[$key] : $this->default;
						}
					}
				}
			} else {
				$this->runConditions($r, $fieldId);
				if ($this->ifFailThenDefault) {
					if ($this->messageList->errorcount)
						$r = $this->default;
				}
			}
		}
		if ($this->messageList->errorcount==$this->countError && $this->successMessage!==null) {
			$this->addMessage($this->successMessage['id'],$this->successMessage['msg'],$this->successMessage['level']);
		}
		if ($this->addToForm) {
			$this->callFormBack($fieldId);
		}
		$this->resetChain();
		return $r;
	}
1345187
protected function _resolveFields($fields)
    {
        if (is_string($fields)) {
            $fields = [$fields];
        }

        if (!is_array($fields)) {
            throw new Exception('Invalid "fields" configuration.');
        }

        $types = array_keys(Type::map());

        foreach ($fields as $field => $type) {
            if (is_numeric($field) && is_string($type)) {
                unset($fields[$field]);
                $field = $type;
                $type = self::DEFAULT_TYPE;
                $fields[$field] = $type;
            }

            if (!in_array($type, $types)) {
                throw new Exception(sprintf('The field "%s" mapped type "%s" was not found.', $field, $type));
            }
        }

        return $fields;
    }
792831
public static function checkDatetimeFormat($field, $format, $msg)
    {
        $date = date($format, strtotime($field));
        if ($field !== $date) {
            throw new MsgException($msg);
        }
    }
1358549
public function decrement($field, $dec = 1) {
        $where = $this->build()->parseWhere();
        if (empty($where)) {
            throw new Exception('缺少更新条件');
        }

        $sql = "UPDATE " . $this->connection->getTable() . " SET {$field}={$field}-$dec " . $where;

        return $this->connection->execute($sql, $this->build()->getUpdateParams());
    }
590281
protected function filterString($field, $details, $label, $message) {
        if (!(is_string($this->getValue($field)) || is_numeric($this->getValue($field)))) {
            throw new \Exception($message ? $message : $this->translate("$label must be string!"));
        }
        $this->setValue($field, $this->getValue($field) . '');
        if (isset($details['trim']) || in_array('trim', $details)) {
            $this->setValue($field, trim($this->getValue($field)));
        }
        if (isset($details['min']) && strlen($this->getValue($field)) < $details['min']) {
            throw new \Exception($message ? $message : $this->translate("$label must have at least $details[min] characters!"));
        }
        if (isset($details['max']) && strlen($this->getValue($field)) > $details['max']) {
            throw new \Exception($message ? $message : $this->translate("$label must have less than $details[min] characters!"));
        }
        $wordsCount = count(explode(' ', str_replace(array(',', ';', ':', '!', '?', '$', '%', '^', '/', '*', '(', ')', '[', ']', '@', '`', '~', '\'', '\\', '"', '}', '{', "\n"), ' ', $this->getValue($field))));
        if (isset($details['min_words']) && $wordsCount < $details['min_words']) {
            throw new \Exception($message ? $message : $this->translate("$label must have at least $details[min_words] words!"));
        }
        if (isset($details['max_words']) && $wordsCount > $details['max_words']) {
            throw new \Exception($message ? $message : $this->translate("$label must have less than $details[max_words] words!"));
        }
        $lines = count(explode("\n", $this->getValue($field)));
        if (isset($details['min_lines']) && $lines < $details['min_lines']) {
            throw new \Exception($message ? $message : $this->translate("$label must have at least $details[min_lines] lines!"));
        }
        if (isset($details['max_lines']) && $lines > $details['max_lines']) {
            throw new \Exception($message ? $message : $this->translate("$label must have less than $details[max_lines] lines!"));
        }
        return true;
    }
1338153
public static function setTypeMsg($type, $msg=null)
    {
        if (is_array($type)) {
            self::$typeMsg=array_merge(self::$typeMsg, $type);
        } else {
            self::$typeMsg[$type]=$msg;
        }
    }
1083055
public function setException($exception, $msg = null)
    {
        if ($exception instanceof MsgException) {
            $this->setMsgException($exception);
        } else {
            SentryHelper::triggerSentryException($exception);

            if (StringUtils::isEmpty($msg)) {
                $msg = "오류가 발생하였습니다. 다시 시도하여 주세요. 문제가 다시 발생할 경우 개발그룹에 문의하여주세요.";
            }
            $this->success = false;
            $this->setMsg($msg);
        }
    }
162540
public function error($msg)
    {
        file_put_contents($this->config['logDir'] . self::LOG_FILE, date('Y-m-d h:m:s') . ' :: ' . $msg . "\n",
            FILE_APPEND);

        // log set as true
        if ($this->log) {
            // show executed query with error
            $this->showQuery();
            // die code
            $this->helper()->errorBox($msg);
        }

        throw new \PDOException($msg);
    }
160849
@Override
    public void error( F0<String> msg )
    {
        if ( compilerLogger.isErrorEnabled() )
        {
            String msgString = msg.apply();
            errors.append( msgString ).append( '\n' );
            compilerLogger.error( msgString );
        }
    }
897280
public static void keeperException(String msg, KeeperException e)
      throws IOException {
    LOG.error(msg, e);
    throw new IOException(msg, e);
  }
468164
protected function filterRegexp($field, $details, $label, $message) {
        if (preg_match($details['expression'], $this->getValue($field))) {
            return true;
        }
        throw new \Exception($message ? $message : $this->translate("Doesn't match expression!"));
    }
96666
protected function throwError($msg = null)
    {
        if ($this->sourceLoc >= 0) {
            $this->sourceParser->throwError($msg, $this->sourceLoc);
        }
        throw new exception($msg);
    }