panic when an extension request is issued before an extension has been initialized. but give a nice error message for the happy people.

This commit is contained in:
Andrew Gallant (Ocelot)
2012-05-11 23:58:52 -04:00
parent fb3128ed2a
commit 29942bf078
29 changed files with 2876 additions and 202 deletions

View File

@@ -2,7 +2,7 @@
package ge
/*
This file was generated by ge.xml on May 11 2012 1:58:35am EDT.
This file was generated by ge.xml on May 11 2012 11:57:19pm EDT.
This file is automatically generated. Edit at your peril!
*/
@@ -72,6 +72,9 @@ type QueryVersionCookie struct {
// QueryVersion sends a checked request.
// If an error occurs, it will be returned with the reply by calling QueryVersionCookie.Reply()
func QueryVersion(c *xgb.Conn, ClientMajorVersion uint16, ClientMinorVersion uint16) QueryVersionCookie {
if _, ok := c.Extensions["GENERIC EVENT EXTENSION"]; !ok {
panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'Generic Event Extension'. ge.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
c.NewRequest(queryVersionRequest(c, ClientMajorVersion, ClientMinorVersion), cookie)
return QueryVersionCookie{cookie}
@@ -80,6 +83,9 @@ func QueryVersion(c *xgb.Conn, ClientMajorVersion uint16, ClientMinorVersion uin
// QueryVersionUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func QueryVersionUnchecked(c *xgb.Conn, ClientMajorVersion uint16, ClientMinorVersion uint16) QueryVersionCookie {
if _, ok := c.Extensions["GENERIC EVENT EXTENSION"]; !ok {
panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'Generic Event Extension'. ge.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
c.NewRequest(queryVersionRequest(c, ClientMajorVersion, ClientMinorVersion), cookie)
return QueryVersionCookie{cookie}