Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
milvus
提交
9dcc68b8
milvus
项目概览
BaiXuePrincess
/
milvus
与 Fork 源项目一致
从无法访问的项目Fork
通知
7
Star
4
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
milvus
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
9dcc68b8
编写于
5月 27, 2019
作者:
X
Xu Peng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat(db): add exception
Former-commit-id: b2a9deb7df0544a303858fff7f4d6eddf3e6b1f7
上级
d744ef4a
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
69 addition
and
9 deletion
+69
-9
cpp/src/db/Exception.h
cpp/src/db/Exception.h
+54
-0
cpp/src/db/Options.cpp
cpp/src/db/Options.cpp
+15
-9
未找到文件。
cpp/src/db/Exception.h
0 → 100644
浏览文件 @
9dcc68b8
/*******************************************************************************
* Copyright 上海赜睿信息科技有限公司(Zilliz) - All Rights Reserved
* Unauthorized copying of this file, via any medium is strictly prohibited.
* Proprietary and confidential.
******************************************************************************/
#pragma once
#include <exception>
#include <string>
namespace
zilliz
{
namespace
vecwise
{
namespace
engine
{
class
Exception
:
public
std
::
exception
{
public:
Exception
(
const
std
::
string
&
message
)
:
message_
(
message
)
{
}
Exception
()
:
message_
()
{
}
virtual
const
char
*
what
()
const
throw
()
{
if
(
message_
.
empty
())
{
return
"Default Exception."
;
}
else
{
return
message_
.
c_str
();
}
}
virtual
~
Exception
()
throw
()
{};
protected:
std
::
string
message_
;
};
class
InvalidArgumentException
:
public
Exception
{
public:
InvalidArgumentException
()
:
Exception
(
"Invalid Argument"
){};
InvalidArgumentException
(
const
std
::
string
&
message
)
:
Exception
(
message
)
{};
};
class
OutOfRangeException
:
public
Exception
{
public:
OutOfRangeException
()
:
Exception
(
"Out Of Range"
){};
OutOfRangeException
(
const
std
::
string
&
message
)
:
Exception
(
message
)
{};
};
}
// namespace engine
}
// namespace vecwise
}
// namespace zilliz
cpp/src/db/Options.cpp
浏览文件 @
9dcc68b8
...
...
@@ -11,6 +11,7 @@
#include "Options.h"
#include "Env.h"
#include "DBMetaImpl.h"
#include "Exception.h"
namespace
zilliz
{
namespace
vecwise
{
...
...
@@ -46,24 +47,29 @@ void ArchiveConf::ParseCritirias(const std::string& criterias) {
LOG
(
WARNING
)
<<
"Invalid ArchiveConf Criterias: "
<<
token
<<
" Ignore!"
;
continue
;
}
auto
value
=
std
::
stoi
(
kv
[
1
]);
criterias_
[
kv
[
0
]]
=
value
;
try
{
auto
value
=
std
::
stoi
(
kv
[
1
]);
criterias_
[
kv
[
0
]]
=
value
;
}
catch
(
std
::
out_of_range
&
){
LOG
(
ERROR
)
<<
"Out of range: '"
<<
kv
[
1
]
<<
"'"
;
throw
OutOfRangeException
();
}
catch
(...){
LOG
(
ERROR
)
<<
"Invalid argument: '"
<<
kv
[
1
]
<<
"'"
;
throw
InvalidArgumentException
();
}
}
}
void
ArchiveConf
::
ParseType
(
const
std
::
string
&
type
)
{
if
(
type
!=
"delete"
&&
type
!=
"swap"
)
{
LOG
(
ERROR
)
<<
"Invalid
Archive
"
;
assert
(
false
);
LOG
(
ERROR
)
<<
"Invalid
argument: type='"
<<
type
<<
"'
"
;
throw
InvalidArgumentException
(
);
}
type_
=
type
;
}
/* DBMetaOptions::DBMetaOptions(const std::string& dbpath, */
/* const std::string& uri) */
/* : path(dbpath), backend_uri(uri) { */
/* } */
}
// namespace engine
}
// namespace vecwise
}
// namespace zilliz
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录