tarantool / tarantool/tarantool
Make space.create params error less vague
Nobody has claimed this yet.
- Dominant language
- Lua
- Stars
- 3.7k
- Forks
- 419
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 88
Description
Is your feature request related to a problem? Please describe.
I've tried to build a simple space for tests. It is a bit painful to debug :eval calls, and it's even more painful if error is vague.
My code was
if not box.cfg.read_only then
local sp = box.schema.space.create(space_name, {
{name = 'id', type = 'unsigned'},
{name = 'bucket_id', type = 'unsigned'},
})
-- create index, etc...
end
and I've got an error Illegal parameters, unexpected option '1'. I've spent some time to get what's this one was about. My mistake was to call with { { name = ... } } as opts instead of { format = {{ name = ... }} }, but it wasn't obvious. Like, there is no explicit 1s in my code.
Describe the solution you'd like
I think an error message You should provide map with options instead of array or Expected opts format is { format = {...}, ... } would be more convenient to interpret.
Describe alternatives you've considered
Not sure there's any.
Additional context
I think provided info should be enough.
Definition of Done
Less vague error message is case of providing array for opts instead of a map.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing box.schema.space.create and its options validation, focusing on the case where opts is an array rather than a map. Review how the :eval call reports the unexpected option, then verify that this input produces a message identifying the expected { format = {...}, ... } structure.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- lua
- Domain
- databases
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100