Should not pass Error objects for later throw

Bug #867008 reported by Paul J. Lucas
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Zorba
New
Medium
Nicolae Brinza

Bug Description

The function checkNamespaceConflict() in ElementNode currently takes an Error code to throw if there is a conflict. The problem passing error codes and throwing them later in general is that different error codes can have different error parameters. But in order for the code as it is to work properly, all error codes passed to the function must have the same error parameters (in the same order) forever. It's difficult to ensure and maintain this consistency.

Therefore, I suggest changing the signature of the function to NOT take an error and instead simply return a bool as to whether there is a conflict. If there is, the calling code should throw an exception itself.

Revision history for this message
Paul J. Lucas (paul-lucas) wrote :

A similar signature change is strongly recommended for the bind_ns() function on the static context.

Revision history for this message
Paul J. Lucas (paul-lucas) wrote :

A similar signature change is strongly recommended for the create_named_type() function in the type manager.

Revision history for this message
Paul J. Lucas (paul-lucas) wrote :

And again for the treat_expr() constructor.

Revision history for this message
Paul J. Lucas (paul-lucas) wrote :

Changed Summary to reflect the more wide-spread issue.

Revision history for this message
Markos Zaharioudakis (markos-za) wrote :

I have removed all uses of the XQUERY_EXCEPTION_VAR macro, except from the one in compiler_api.cpp: That one is handling errors coming from the parser, so I am transfering this bug to Nicolae to fix this last use.

Changed in zorba:
assignee: Markos Zaharioudakis (markos-za) → Nicolae Brinza (nbrinza)
Chris Hillery (ceejatec)
tags: removed: simple-store
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.