HouzuoGuo/tiedot — pull request #78 by omeid (2014-12-05 08:42:25+00:00)
Title: Make dberr.Error thread-safe.

Today I learned that the initial error mechanism that I wrote for tiedot isn't treadsafe and multiple goroutiens calling `dberr.Error.Error()` would result in a race and ended up with a crash.

I have refactored the code to make it threadsafe.

I have also refactored out the `dberr.Error.Code` as it seem pretty redundent to me. If you think they can be helpful. It should be very easy to reintroduce them and add a `dberr.Code(e *Error) int` to handle them like how currently Error types are handled.

Please revivew the code and let me know if anything can be improved.