diff options
author | Andrew Gallant (Ocelot) <Andrew.Gallant@tufts.edu> | 2012-05-11 23:58:52 -0400 |
---|---|---|
committer | Andrew Gallant (Ocelot) <Andrew.Gallant@tufts.edu> | 2012-05-11 23:58:52 -0400 |
commit | 29942bf078c92fea681e42ca5029592526f00718 (patch) | |
tree | cee802ebe16e0b118c9be0f6265e26d31e8a5845 /nexgb/bigreq | |
parent | fb3128ed2a83a0f644661cedebbe5bfda3f4951e (diff) | |
download | haven-29942bf078c92fea681e42ca5029592526f00718.tar.gz haven-29942bf078c92fea681e42ca5029592526f00718.tar.xz haven-29942bf078c92fea681e42ca5029592526f00718.zip |
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 'nexgb/bigreq')
-rw-r--r-- | nexgb/bigreq/bigreq.go | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/nexgb/bigreq/bigreq.go b/nexgb/bigreq/bigreq.go index 32dacba..43a15a4 100644 --- a/nexgb/bigreq/bigreq.go +++ b/nexgb/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} |