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.