This may help you: https://github.com/prometheus/prometheus/blob/master/utility/test/error.go.