mongoose-geojson-schema icon indicating copy to clipboard operation
mongoose-geojson-schema copied to clipboard

CastError surfacing still an issue

Open joshkopecek opened this issue 9 years ago • 3 comments
trafficstars

Despite using mongoose.Error() when I use the Schema Types in another project I get this:

Unhandled rejection ValidationError: CastError: Cast to Point failed for value "[object Object]" at path "loc"

and no 'reason' which is less than helpful since I can't see why my object is not passing. Building a custom error seems unnecessarily onerous (https://github.com/Automattic/mongoose/issues/4113).

Thoughts @markstos ?

joshkopecek avatar May 16 '16 14:05 joshkopecek

Ugh. I'm not sure what to do here. It seems like a might be an ordering issue, like the CastError is being thrown before the custom error. At this point I would resort to reading the Mongoose code and tracing the flow of what's happening.

markstos avatar May 16 '16 19:05 markstos

I've opened a new Mongoose issue requesting the option to disable type casting. Saw several of your issues that might be more easily handled if this were an option.

https://github.com/Automattic/mongoose/issues/4745

benfletcher avatar Nov 27 '16 03:11 benfletcher

Saw that that issue was closed on mongoose without resolution. I will leave this open as there is no current resolution for it.

joshkopecek avatar Mar 02 '17 09:03 joshkopecek