Commit a1e847ee authored by bashi@chromium.org's avatar bashi@chromium.org

IDL: Use user-friendly type names for error messages

This is a follow-up CL of https://codereview.chromium.org/690923004/.

It would be great to show "(A or B)" rather than "AOrB".

BUG=240176

Review URL: https://codereview.chromium.org/722523003

git-svn-id: svn://svn.chromium.org/blink/trunk@185195 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent c928e19e
......@@ -15,15 +15,15 @@ PASS new TrackEvent('TrackEvent', { bubbles: true, cancelable: true }).cancelabl
PASS new TrackEvent('TrackEvent', { bubbles: true, cancelable: true }).track is null
*** Bubbles and cancelable true, invalid track ***
PASS new TrackEvent('TrackEvent', { bubbles: true, cancelable: true, track: HTMLTrackElement }).bubbles threw exception TypeError: Failed to construct 'TrackEvent': The 'track' property does not have a VideoTrackOrAudioTrackOrTextTrack type..
PASS new TrackEvent('TrackEvent', { bubbles: true, cancelable: true, track: HTMLTrackElement }).cancelable threw exception TypeError: Failed to construct 'TrackEvent': The 'track' property does not have a VideoTrackOrAudioTrackOrTextTrack type..
PASS new TrackEvent('TrackEvent', { bubbles: true, cancelable: true, track: HTMLTrackElement }).track threw exception TypeError: Failed to construct 'TrackEvent': The 'track' property does not have a VideoTrackOrAudioTrackOrTextTrack type..
PASS new TrackEvent('TrackEvent', { bubbles: true, cancelable: true, track: HTMLTrackElement }).bubbles threw exception TypeError: Failed to construct 'TrackEvent': The 'track' property does not have a (VideoTrack or AudioTrack or TextTrack) type..
PASS new TrackEvent('TrackEvent', { bubbles: true, cancelable: true, track: HTMLTrackElement }).cancelable threw exception TypeError: Failed to construct 'TrackEvent': The 'track' property does not have a (VideoTrack or AudioTrack or TextTrack) type..
PASS new TrackEvent('TrackEvent', { bubbles: true, cancelable: true, track: HTMLTrackElement }).track threw exception TypeError: Failed to construct 'TrackEvent': The 'track' property does not have a (VideoTrack or AudioTrack or TextTrack) type..
*** Initialize 'track' with a invalid values ***
PASS new TrackEvent('TrackEvent', { track: 10 }).track threw exception TypeError: Failed to construct 'TrackEvent': The 'track' property does not have a VideoTrackOrAudioTrackOrTextTrack type..
PASS new TrackEvent('TrackEvent', { track: 'string' }).track threw exception TypeError: Failed to construct 'TrackEvent': The 'track' property does not have a VideoTrackOrAudioTrackOrTextTrack type..
PASS new TrackEvent('TrackEvent', { track: emptyObject }).track threw exception TypeError: Failed to construct 'TrackEvent': The 'track' property does not have a VideoTrackOrAudioTrackOrTextTrack type..
PASS new TrackEvent('TrackEvent', { track: document }).track threw exception TypeError: Failed to construct 'TrackEvent': The 'track' property does not have a VideoTrackOrAudioTrackOrTextTrack type..
PASS new TrackEvent('TrackEvent', { track: 10 }).track threw exception TypeError: Failed to construct 'TrackEvent': The 'track' property does not have a (VideoTrack or AudioTrack or TextTrack) type..
PASS new TrackEvent('TrackEvent', { track: 'string' }).track threw exception TypeError: Failed to construct 'TrackEvent': The 'track' property does not have a (VideoTrack or AudioTrack or TextTrack) type..
PASS new TrackEvent('TrackEvent', { track: emptyObject }).track threw exception TypeError: Failed to construct 'TrackEvent': The 'track' property does not have a (VideoTrack or AudioTrack or TextTrack) type..
PASS new TrackEvent('TrackEvent', { track: document }).track threw exception TypeError: Failed to construct 'TrackEvent': The 'track' property does not have a (VideoTrack or AudioTrack or TextTrack) type..
*** Bubbles and cancelable true, valid track ***
PASS new TrackEvent('TrackEvent', { bubbles: true, cancelable: true, track: trackElement.track }).bubbles is true
......
......@@ -253,7 +253,7 @@ class IdlUnionType(IdlTypeBase):
self.member_types = member_types
def __str__(self):
return self.name
return '(' + ' or '.join(str(member_type) for member_type in self.member_types) + ')'
def __hash__(self):
return hash(self.name)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment