This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 1460 - Error code for casting errors
Summary: Error code for casting errors
Status: CLOSED FIXED
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: XPath 2.0 (show other bugs)
Version: Last Call drafts
Hardware: PC Windows XP
: P2 normal
Target Milestone: ---
Assignee: Don Chamberlin
QA Contact: Mailing list for public feedback on specs from XSL and XML Query WGs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-05-17 16:52 UTC by Michael Kay
Modified: 2005-09-29 11:20 UTC (History)
0 users

See Also:


Attachments

Description Michael Kay 2005-05-17 16:52:02 UTC
What error code do you get if you try to cast from a source type to a target
type for which casting is not permitted (e.g. cast integer to anyURI)?

The language book (3.12.3 4f) says:

For any combination of input type and target type that is not in the above list,
a cast expression raises a type error [err:XPTY0004].

F+O (section 17) says:

If casting is attempted from an ST to a TT for which casting is not supported,
an error is raised [err:FORG0001].

(Yet another illustration of the problems caused by describing casting in more
than one place.)

The casting tests in the test suite seem to assume the XPTY0004 is correct.

Michael Kay
Comment 1 Michael Rys 2005-05-17 17:23:17 UTC
Casting are runtime errors and do not fall into the category of type errors, 
however, if no instance of a type can be cast to another type, you can raise 
the error statically...
Comment 2 Ashok Malhotra 2005-05-19 21:58:32 UTC
This was discussed in the joint QT WG meeting on 5/19/2005 and it was decided to
change the error code in the F&O to conform to the error code in the language
documents:  XPTY0004.

Ashok Malhotra