Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OBITools3
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
21
Issues
21
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
OBITools
OBITools3
Commits
0a0f0682
Commit
0a0f0682
authored
Oct 17, 2018
by
Celine Mercier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Better handling of errors and exceptions when new view name already
exists
parent
4802e32f
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
12 additions
and
3 deletions
+12
-3
python/obitools3/dms/capi/obierrno.pxd
python/obitools3/dms/capi/obierrno.pxd
+1
-0
python/obitools3/uri/decode.pyx
python/obitools3/uri/decode.pyx
+7
-1
src/obierrno.h
src/obierrno.h
+2
-0
src/obiview.c
src/obiview.c
+2
-2
No files found.
python/obitools3/dms/capi/obierrno.pxd
View file @
0a0f0682
...
...
@@ -6,3 +6,4 @@ cdef extern from "obierrno.h":
extern
int
OBI_LINE_IDX_ERROR
extern
int
OBI_ELT_IDX_ERROR
extern
int
OBIVIEW_ALREADY_EXISTS_ERROR
python/obitools3/uri/decode.pyx
View file @
0a0f0682
...
...
@@ -22,6 +22,9 @@ from obitools3.apps.config import getConfiguration,logger
from
obitools3.apps.temp
import
get_temp_dms
from
obitools3.utils
cimport
tobytes
# TODO because can't read options as bytes
from
obitools3.dms.capi.obierrno
cimport
obi_errno
,
\
OBIVIEW_ALREADY_EXISTS_ERROR
class
MalformedURIException
(
RuntimeError
):
pass
...
...
@@ -219,10 +222,13 @@ def open_uri(uri,
type
(
resource
[
1
]),
urlunparse
(
urip
))
except
Exception
as
e
:
global
obi_errno
if
obi_errno
==
OBIVIEW_ALREADY_EXISTS_ERROR
:
raise
Exception
(
"View name already exists in this DMS"
)
error
=
e
if
scheme
==
b
"dms"
:
logger
(
'Error'
,
'
cannot open DMS
: %s'
,
uri
)
logger
(
'Error'
,
'
Could not open DMS URI
: %s'
,
uri
)
raise
FileNotFoundError
(
'uri'
)
if
not
urip
.
scheme
:
...
...
src/obierrno.h
View file @
0a0f0682
...
...
@@ -128,6 +128,8 @@ extern int obi_errno;
*/
#define OBI_JSON_ERROR (34)
/** Error related to JSON operations.
*/
#define OBIVIEW_ALREADY_EXISTS_ERROR (35)
/** Tried to create a new view with a name already existing in the DMS.
*/
/**@}*/
#endif
/* OBIERRNO_H_ */
src/obiview.c
View file @
0a0f0682
...
...
@@ -1496,8 +1496,8 @@ Obiview_p obi_new_view(OBIDMS_p dms, const char* view_name, Obiview_p view_to_cl
// Check uniqueness of name
if
(
view_exists
(
dms
,
view_name
))
{
obi_set_errno
(
OBIVIEW_ERROR
);
obidebug
(
1
,
"
\n
Name of new view
already exists"
);
obi_set_errno
(
OBIVIEW_
ALREADY_EXISTS_
ERROR
);
obidebug
(
1
,
"
\n
Name of new view
('%s') already exists"
,
view_name
);
return
NULL
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment