Skip to main content

to_ecma_display

Function to_ecma_display 

Source
pub fn to_ecma_display(value: &ParseValue) -> String
Expand description

String(value), the coercion a JavaScript template literal or + performs.

Upstream builds several client-visible error messages by concatenating a value into a string, so the rendering is part of the wire contract rather than a debugging convenience: You cannot use ${value} as a query parameter. (MongoTransform.js:352) and 'This is not a valid ' + obj.__type (SchemaController.js) both reach a client.

The two cases worth naming: an array joins its elements on commas after coercing each one, so nesting flattens and null renders as the empty string; and every other object is the literal [object Object], which is why a malformed operand’s message says nothing about it.