Build issues `undefined: "github.com/corestoreio/errors".NewWriteFailed`
Unable to build. The following errors are produced.
# github.com/corestoreio/caddy-esi/esitag
../../../corestoreio/caddy-esi/esitag/data_tag.go:121:20: undefined: "github.com/corestoreio/errors".NewWriteFailed
../../../corestoreio/caddy-esi/esitag/data_tag.go:155:23: undefined: "github.com/corestoreio/errors".NewWriteFailed
../../../corestoreio/caddy-esi/esitag/data_tag.go:177:24: undefined: "github.com/corestoreio/errors".NewWriteFailed
../../../corestoreio/caddy-esi/esitag/data_tag.go:183:24: undefined: "github.com/corestoreio/errors".NewWriteFailed
../../../corestoreio/caddy-esi/esitag/data_tag.go:190:25: undefined: "github.com/corestoreio/errors".NewWriteFailed
../../../corestoreio/caddy-esi/esitag/data_tag.go:199:24: undefined: "github.com/corestoreio/errors".NewWriteFailed
../../../corestoreio/caddy-esi/esitag/data_tag.go:205:24: undefined: "github.com/corestoreio/errors".NewWriteFailed
../../../corestoreio/caddy-esi/esitag/data_tag.go:211:24: undefined: "github.com/corestoreio/errors".NewWriteFailed
../../../corestoreio/caddy-esi/esitag/data_tag.go:222:23: undefined: "github.com/corestoreio/errors".NewWriteFailed
../../../corestoreio/caddy-esi/esitag/data_tag.go:228:23: undefined: "github.com/corestoreio/errors".NewWriteFailed
../../../corestoreio/caddy-esi/esitag/data_tag.go:228:23: too many errors
That won't get fixed too soon.
hey @SchumacherFM It looks pretty interesting in terms of the architecture using ESI tags and a Caddy proxy.
Regarding the errors, i can se what your trying to do in terms of returning errors with context designed for ESI ( i assume ). It looks like only one file has then, so maybe for now we can just wrap the calling code to return normal errors OR ESI style errors.
How the code is now:
if dts.Len() == 0 || dataLen == 0 {
wn, err := w.Write(data)
nWritten += wn
return nWritten, errors.NewWriteFailed(err, "[esitag] Failed to write")
}
Suggested quick fix:
var useEsiError = true
if dts.Len() == 0 || dataLen == 0 {
wn, err := w.Write(data)
nWritten += wn
if useEsiError {
//TODO: return nWritten, errors.NewWriteFailed(err, "[esitag] Failed to write")
}
return nWritten, errors.WithMessage(err, "[esitag] Failed to write")
}
This is just to stub out the code thats stopping compilation for now. I think its maybe 10 to 15 locations in that one file.
Hi @gedw99
thanks for looking into this. But it needs a total refactor instead of commenting out the old code.
I've refactored the errors and the code does now compile but there are architectural errors because of the changed caddy middlewares. So caddy-esi does not work as expected.
I might be looking into this in the next couple of months.