Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fatal Error: could not create List from JSON #148

Closed
fabien opened this issue Jun 20, 2014 · 2 comments
Closed

Fatal Error: could not create List from JSON #148

fabien opened this issue Jun 20, 2014 · 2 comments

Comments

@fabien
Copy link
Contributor

fabien commented Jun 20, 2014

An app crashes when a 'list' (array) property doesn't receive the correct input:

"tags": {
  "type": ["string"]
}

REST Request (pseudo code): POST { "tags": "one" } (should have been array not string)

Error: could not create List from JSON string: at new List (<...>/node_modules/loopback-datasource-juggler/lib/list.js:16:13)

This should be handled gracefully by any means, not bail out completely! (perhaps even cast a scalar to an single-item array). A more extensible approach would be custom formatters/converters/coercing - see #128

@raymondfeng
Copy link
Contributor

I agree. Another way to handle the errors gracefully is to use domain or Zone, which might introduce quite a bit overhead.

@raymondfeng
Copy link
Contributor

Duplicate of #111

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants