diff options
| author | Andrew Gallant (Ocelot) <[email protected]> | 2012-05-11 23:58:52 -0400 |
|---|---|---|
| committer | Andrew Gallant (Ocelot) <[email protected]> | 2012-05-11 23:58:52 -0400 |
| commit | d3b0a6b2da335ee0f2d4e4b01d708d73ea373f2c (patch) | |
| tree | d2bdecbb93439996f4249d6b317527e91bbffd4c /bigreq/bigreq.go | |
| parent | e7773ad874c829516a786cbd91ed3fdd9a86e48d (diff) | |
panic when an extension request is issued before an extension has been initialized. but give a nice error message for the happy people.
Diffstat (limited to 'bigreq/bigreq.go')
| -rw-r--r-- | bigreq/bigreq.go | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/bigreq/bigreq.go b/bigreq/bigreq.go index 32dacba..43a15a4 100644 --- a/bigreq/bigreq.go +++ b/bigreq/bigreq.go @@ -2,7 +2,7 @@ package bigreq /* - This file was generated by bigreq.xml on May 11 2012 1:58:35am EDT. + This file was generated by bigreq.xml on May 11 2012 11:57:18pm EDT. This file is automatically generated. Edit at your peril! */ @@ -40,6 +40,10 @@ func init() { xgb.NewExtErrorFuncs["BIG-REQUESTS"] = make(map[int]xgb.NewErrorFun) } +// Skipping definition for base type 'Bool' + +// Skipping definition for base type 'Float' + // Skipping definition for base type 'Card8' // Skipping definition for base type 'Int16' @@ -60,10 +64,6 @@ func init() { // Skipping definition for base type 'Double' -// Skipping definition for base type 'Bool' - -// Skipping definition for base type 'Float' - // EnableCookie is a cookie used only for Enable requests. type EnableCookie struct { *xgb.Cookie @@ -72,6 +72,9 @@ type EnableCookie struct { // Enable sends a checked request. // If an error occurs, it will be returned with the reply by calling EnableCookie.Reply() func Enable(c *xgb.Conn) EnableCookie { + if _, ok := c.Extensions["BIG-REQUESTS"]; !ok { + panic("Cannot issue request 'Enable' using the uninitialized extension 'BIG-REQUESTS'. bigreq.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, true) c.NewRequest(enableRequest(c), cookie) return EnableCookie{cookie} @@ -80,6 +83,9 @@ func Enable(c *xgb.Conn) EnableCookie { // EnableUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func EnableUnchecked(c *xgb.Conn) EnableCookie { + if _, ok := c.Extensions["BIG-REQUESTS"]; !ok { + panic("Cannot issue request 'Enable' using the uninitialized extension 'BIG-REQUESTS'. bigreq.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, true) c.NewRequest(enableRequest(c), cookie) return EnableCookie{cookie} |
